test/java/rmi/server/Unreferenced/unreferencedContext/UnreferencedContext.java
Print this page
@@ -39,10 +39,11 @@
* @author Laird Dornin
*
* @library ../../../testlibrary
* @build UnreferencedContext
* @build UnreferencedContext_Stub
+ * @build TestLibrary
* @run main/othervm/timeout=120 UnreferencedContext
*/
import java.net.*;
import java.rmi.*;
@@ -117,14 +118,15 @@
intendedContext);
UnicastRemoteObject.exportObject(obj);
System.err.println("exported remote object");
- LocateRegistry.createRegistry(TestLibrary.REGISTRY_PORT);
+ Registry registry1 = TestLibrary.createRegistryOnUnusedPort();
+ int port = TestLibrary.getRegistryPort(registry1);
System.err.println("created registry");
- Registry registry = LocateRegistry.getRegistry("", TestLibrary.REGISTRY_PORT);
+ Registry registry = LocateRegistry.getRegistry("", port);
registry.bind(BINDING, obj);
System.err.println("bound remote object in registry");
synchronized (obj.lock) {
registry.unbind(BINDING);