15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /* @test
25 * @bug 4115331
26 * @summary synopsis: activatable object fails to go inactive after
27 * unregister/inactive sequence.
28 * @author Ann Wollrath
29 *
30 * @library ../../../testlibrary
31 * @modules java.rmi/sun.rmi.registry
32 * java.rmi/sun.rmi.server
33 * java.rmi/sun.rmi.transport
34 * java.rmi/sun.rmi.transport.tcp
35 * @build TestLibrary RMID ActivationLibrary ActivateMe UnregisterInactive_Stub
36 * @run main/othervm/policy=security.policy/timeout=240 UnregisterInactive
37 */
38
39 import java.io.*;
40 import java.rmi.*;
41 import java.rmi.activation.*;
42 import java.rmi.server.*;
43 import java.rmi.registry.*;
44 import java.util.Properties;
45
46 public class UnregisterInactive
47 extends Activatable
48 implements ActivateMe, Runnable
49 {
50
51 public UnregisterInactive(ActivationID id, MarshalledObject obj)
52 throws ActivationException, RemoteException
53 {
54 super(id, 0);
55 }
72 /**
73 * Thread to deactivate object. First attempts to make object
74 * inactive (via the inactive method). If that fails (the
75 * object may still have pending/executing calls), then
76 * unexport the object forcibly.
77 */
78 public void run() {
79 ActivationLibrary.deactivate(this, getID());
80 }
81
82 public static void main(String[] args) {
83
84 System.out.println("\nRegression test for bug 4115331\n");
85
86 TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
87
88 RMID rmid = null;
89
90 try {
91 RMID.removeLog();
92 rmid = RMID.createRMID();
93 rmid.start();
94 System.err.println("Creating descriptor");
95
96
97 /* Cause activation groups to have a security policy that will
98 * allow security managers to be downloaded and installed
99 */
100 Properties p = new Properties();
101 // this test must always set policies/managers in its
102 // activation groups
103 p.put("java.security.policy",
104 TestParams.defaultGroupPolicy);
105 p.put("java.security.manager",
106 TestParams.defaultSecurityManager);
107
108 ActivationGroupDesc groupDesc =
109 new ActivationGroupDesc(p, null);
110 ActivationSystem system = ActivationGroup.getSystem();
111 ActivationGroupID groupID = system.registerGroup(groupDesc);
112 ActivationGroup.createGroup(groupID, groupDesc, 0);
|
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /* @test
25 * @bug 4115331
26 * @summary synopsis: activatable object fails to go inactive after
27 * unregister/inactive sequence.
28 * @author Ann Wollrath
29 *
30 * @library ../../../testlibrary
31 * @modules java.rmi/sun.rmi.registry
32 * java.rmi/sun.rmi.server
33 * java.rmi/sun.rmi.transport
34 * java.rmi/sun.rmi.transport.tcp
35 * java.base/sun.nio.ch
36 * @build TestLibrary RMID RMIDSelectorProvider ActivationLibrary ActivateMe UnregisterInactive_Stub
37 * @run main/othervm/policy=security.policy/timeout=240 UnregisterInactive
38 */
39
40 import java.io.*;
41 import java.rmi.*;
42 import java.rmi.activation.*;
43 import java.rmi.server.*;
44 import java.rmi.registry.*;
45 import java.util.Properties;
46
47 public class UnregisterInactive
48 extends Activatable
49 implements ActivateMe, Runnable
50 {
51
52 public UnregisterInactive(ActivationID id, MarshalledObject obj)
53 throws ActivationException, RemoteException
54 {
55 super(id, 0);
56 }
73 /**
74 * Thread to deactivate object. First attempts to make object
75 * inactive (via the inactive method). If that fails (the
76 * object may still have pending/executing calls), then
77 * unexport the object forcibly.
78 */
79 public void run() {
80 ActivationLibrary.deactivate(this, getID());
81 }
82
83 public static void main(String[] args) {
84
85 System.out.println("\nRegression test for bug 4115331\n");
86
87 TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
88
89 RMID rmid = null;
90
91 try {
92 RMID.removeLog();
93 rmid = RMID.createRMIDOnEphemeralPort();
94 rmid.start();
95 System.err.println("Creating descriptor");
96
97
98 /* Cause activation groups to have a security policy that will
99 * allow security managers to be downloaded and installed
100 */
101 Properties p = new Properties();
102 // this test must always set policies/managers in its
103 // activation groups
104 p.put("java.security.policy",
105 TestParams.defaultGroupPolicy);
106 p.put("java.security.manager",
107 TestParams.defaultSecurityManager);
108
109 ActivationGroupDesc groupDesc =
110 new ActivationGroupDesc(p, null);
111 ActivationSystem system = ActivationGroup.getSystem();
112 ActivationGroupID groupID = system.registerGroup(groupDesc);
113 ActivationGroup.createGroup(groupID, groupDesc, 0);
|