Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
fce9f9f6
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
fce9f9f6
编写于
7月 27, 2012
作者:
D
dmocek
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7186111: fix bugs in java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup
Reviewed-by: smarks, jgish
上级
32268971
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
40 addition
and
38 deletion
+40
-38
test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java
...ion/ActivationSystem/unregisterGroup/UnregisterGroup.java
+32
-38
test/java/rmi/activation/ActivationSystem/unregisterGroup/group.security.policy
...on/ActivationSystem/unregisterGroup/group.security.policy
+1
-0
test/java/rmi/activation/ActivationSystem/unregisterGroup/rmid.security.policy
...ion/ActivationSystem/unregisterGroup/rmid.security.policy
+1
-0
test/java/rmi/activation/ActivationSystem/unregisterGroup/security.policy
...tivation/ActivationSystem/unregisterGroup/security.policy
+6
-0
未找到文件。
test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java
浏览文件 @
fce9f9f6
...
...
@@ -45,30 +45,23 @@ import java.rmi.registry.*;
import
java.util.Properties
;
class
Callback
extends
UnicastRemoteObject
implements
CallbackInterface
{
public
static
int
num_deactivated
=
0
;
public
int
num_deactivated
=
0
;
public
Callback
()
throws
RemoteException
{
super
();
}
public
void
inc
()
throws
RemoteException
{
incNumDeactivated
()
;
public
synchronized
void
inc
()
throws
RemoteException
{
num_deactivated
++
;
}
public
synchronized
int
getNumDeactivated
()
throws
RemoteException
{
return
(
num_deactivated
)
;
return
num_deactivated
;
}
public
synchronized
void
incNumDeactivated
()
{
num_deactivated
++;
}
}
public
class
UnregisterGroup
extends
Activatable
implements
ActivateMe
,
Runnable
{
private
static
Exception
exception
=
null
;
private
static
String
error
=
null
;
private
static
boolean
done
=
false
;
...
...
@@ -104,36 +97,47 @@ public class UnregisterGroup
}
/**
* Thread to deactivate object.
First attempts to make object
*
inactive (via the inactive method). If that fails (the
*
object may still have pending/executing calls), then
*
unexport the object forcibly
.
* Thread to deactivate object.
Get the callback object from the registry,
*
call inc() on it, and finally call deactivate(). The call to
*
deactivate() causes this JVM to be destroyed, so anything following
*
might not be executed
.
*/
public
void
run
()
{
String
regPortStr
=
System
.
getProperty
(
"unregisterGroup.port"
);
int
regPort
=
-
1
;
ActivationLibrary
.
deactivate
(
this
,
getID
());
System
.
err
.
println
(
"\tActivationLibrary.deactivate returned"
);
if
(
regPortStr
!=
null
)
{
regPort
=
Integer
.
parseInt
(
regPortStr
);
}
try
{
CallbackInterface
cobj
=
(
CallbackInterface
)
Naming
.
lookup
(
"//:"
+
reg
istry
Port
+
"/Callback"
);
(
CallbackInterface
)
Naming
.
lookup
(
"//:"
+
regPort
+
"/Callback"
);
cobj
.
inc
();
System
.
err
.
println
(
"cobj.inc called and returned ok"
);
}
catch
(
Exception
e
)
{
System
.
err
.
println
(
"cobj.inc exception"
);
e
.
printStackTrace
();
}
ActivationLibrary
.
deactivate
(
this
,
getID
());
System
.
err
.
println
(
"\tActivationLibrary.deactivate returned"
);
}
public
static
void
main
(
String
[]
args
)
{
Registry
registry
;
public
static
void
main
(
String
[]
args
)
throws
RemoteException
{
System
.
err
.
println
(
"\nRegression test for bug 4134233\n"
);
TestLibrary
.
suggestSecurityManager
(
"java.rmi.RMISecurityManager"
);
RMID
rmid
=
null
;
// Create registry and export callback object so they're
// available to the objects that are activated below.
// TODO: see if we can use RMID's registry instead of
// creating one here.
Registry
registry
=
TestLibrary
.
createRegistryOnUnusedPort
();
registryPort
=
TestLibrary
.
getRegistryPort
(
registry
);
Callback
robj
=
new
Callback
();
registry
.
rebind
(
"Callback"
,
robj
);
try
{
RMID
.
removeLog
();
rmid
=
RMID
.
createRMID
();
...
...
@@ -149,8 +153,7 @@ public class UnregisterGroup
TestParams
.
defaultGroupPolicy
);
p
.
put
(
"java.security.manager"
,
TestParams
.
defaultSecurityManager
);
//final int NUM_OBJECTS = 10;
p
.
put
(
"unregisterGroup.port"
,
Integer
.
toString
(
registryPort
));
Thread
t
=
new
Thread
()
{
public
void
run
()
{
...
...
@@ -219,8 +222,6 @@ public class UnregisterGroup
}
else
{
System
.
err
.
println
(
"Test passed"
);
}
}
catch
(
Exception
e
)
{
TestLibrary
.
bomb
(
"test failed"
,
e
);
}
finally
{
...
...
@@ -233,13 +234,6 @@ public class UnregisterGroup
// Wait for the object deactivation to take place first
try
{
// create reg and export callback object
registry
=
TestLibrary
.
createRegistryOnUnusedPort
();
registryPort
=
TestLibrary
.
getRegistryPort
(
registry
);
Callback
robj
=
new
Callback
();
registry
.
bind
(
"Callback"
,
robj
);
//get the callback object
int
maxwait
=
30
;
int
nd
=
robj
.
getNumDeactivated
();
...
...
test/java/rmi/activation/ActivationSystem/unregisterGroup/group.security.policy
浏览文件 @
fce9f9f6
...
...
@@ -7,4 +7,5 @@ grant {
// test needs to communicate with the activation system
permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
permission java.util.PropertyPermission "unregisterGroup.port", "read";
};
test/java/rmi/activation/ActivationSystem/unregisterGroup/rmid.security.policy
浏览文件 @
fce9f9f6
grant {
permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.manager=default";
permission com.sun.rmi.rmid.ExecOptionPermission "-Djava.security.policy=*";
permission com.sun.rmi.rmid.ExecOptionPermission "-DunregisterGroup.port=*";
};
test/java/rmi/activation/ActivationSystem/unregisterGroup/security.policy
浏览文件 @
fce9f9f6
...
...
@@ -33,4 +33,10 @@ grant {
// test needs to export rmid and communicate with objects on arbitrary ports
permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
// required for test to get the registry port
permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.registry";
permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.server";
permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.transport";
permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.transport.tcp";
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录