14 *
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 4110548
26 * @summary activate fails if rmid is restarted
27 * @author Ann Wollrath
28 *
29 * @library ../../../testlibrary
30 * @modules java.rmi/sun.rmi.registry
31 * java.rmi/sun.rmi.server
32 * java.rmi/sun.rmi.transport
33 * java.rmi/sun.rmi.transport.tcp
34 * @build TestLibrary RMID ActivationLibrary
35 * ActivateMe CheckRegisterInLog_Stub
36 * @run main/othervm/policy=security.policy/timeout=240 CheckRegisterInLog
37 */
38
39 import java.io.*;
40 import java.rmi.*;
41 import java.rmi.server.*;
42 import java.rmi.activation.*;
43 import sun.rmi.server.ActivatableRef;
44 import java.lang.reflect.*;
45 import java.util.Properties;
46
47 public class CheckRegisterInLog
48 extends Activatable
49 implements ActivateMe, Runnable
50 {
51
52 public CheckRegisterInLog(ActivationID id, MarshalledObject obj)
53 throws ActivationException, RemoteException
82 * VM can exit gracefully when this test completes. Otherwise, the
83 * conservative garbage collector will find a handle to the server
84 * object on the native stack and not clear the weak reference to
85 * it in the RMI runtime's object table.
86 */
87 Object dummy = new Object();
88 RMID rmid = null;
89 ActivateMe obj;
90
91 System.out.println("\nRegression test for bug 4110548\n");
92
93 CheckRegisterInLog server;
94
95 try {
96 TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
97
98 /*
99 * Start up activation system daemon "rmid".
100 */
101 RMID.removeLog();
102 rmid = RMID.createRMID();
103 rmid.start();
104
105 /* Cause activation groups to have a security policy that will
106 * allow security managers to be downloaded and installed
107 */
108 Properties p = new Properties();
109 // this test must always set policies/managers in its
110 // activation groups
111 p.put("java.security.policy",
112 TestParams.defaultGroupPolicy);
113 p.put("java.security.manager",
114 TestParams.defaultSecurityManager);
115
116 /*
117 * Register an activation group and an object
118 * in that group.
119 */
120 System.err.println("Creating group descriptor");
121 ActivationGroupDesc groupDesc =
122 new ActivationGroupDesc(p, null);
|
14 *
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 4110548
26 * @summary activate fails if rmid is restarted
27 * @author Ann Wollrath
28 *
29 * @library ../../../testlibrary
30 * @modules java.rmi/sun.rmi.registry
31 * java.rmi/sun.rmi.server
32 * java.rmi/sun.rmi.transport
33 * java.rmi/sun.rmi.transport.tcp
34 * java.base/sun.nio.ch
35 * @build TestLibrary RMID ActivationLibrary
36 * ActivateMe CheckRegisterInLog_Stub
37 * @run main/othervm/policy=security.policy/timeout=240 CheckRegisterInLog
38 */
39
40 import java.io.*;
41 import java.rmi.*;
42 import java.rmi.server.*;
43 import java.rmi.activation.*;
44 import sun.rmi.server.ActivatableRef;
45 import java.lang.reflect.*;
46 import java.util.Properties;
47
48 public class CheckRegisterInLog
49 extends Activatable
50 implements ActivateMe, Runnable
51 {
52
53 public CheckRegisterInLog(ActivationID id, MarshalledObject obj)
54 throws ActivationException, RemoteException
83 * VM can exit gracefully when this test completes. Otherwise, the
84 * conservative garbage collector will find a handle to the server
85 * object on the native stack and not clear the weak reference to
86 * it in the RMI runtime's object table.
87 */
88 Object dummy = new Object();
89 RMID rmid = null;
90 ActivateMe obj;
91
92 System.out.println("\nRegression test for bug 4110548\n");
93
94 CheckRegisterInLog server;
95
96 try {
97 TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
98
99 /*
100 * Start up activation system daemon "rmid".
101 */
102 RMID.removeLog();
103 rmid = RMID.createRMIDOnEphemeralPort();
104 rmid.start();
105
106 /* Cause activation groups to have a security policy that will
107 * allow security managers to be downloaded and installed
108 */
109 Properties p = new Properties();
110 // this test must always set policies/managers in its
111 // activation groups
112 p.put("java.security.policy",
113 TestParams.defaultGroupPolicy);
114 p.put("java.security.manager",
115 TestParams.defaultSecurityManager);
116
117 /*
118 * Register an activation group and an object
119 * in that group.
120 */
121 System.err.println("Creating group descriptor");
122 ActivationGroupDesc groupDesc =
123 new ActivationGroupDesc(p, null);
|