test/java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -27,10 +27,11 @@
*
* @author Laird Dornin
*
* @library ../../testlibrary
* @build CheckLeaseLeak CheckLeaseLeak_Stub LeaseLeakClient LeaseLeak
+ * @build TestLibrary
* @run main/othervm/timeout=240 CheckLeaseLeak
*
*/
/**
@@ -55,11 +56,10 @@
import java.io.*;
import java.lang.reflect.*;
import java.rmi.registry.*;
public class CheckLeaseLeak extends UnicastRemoteObject implements LeaseLeak {
-
public CheckLeaseLeak() throws RemoteException { }
public void ping () throws RemoteException { }
/**
* Id to fake the DGC_ID, so we can later get a reference to the
@@ -85,23 +85,26 @@
TestLibrary.setInteger("java.rmi.dgc.leaseValue",
LEASE_VALUE);
try {
Registry registry =
- java.rmi.registry.LocateRegistry.
- createRegistry(TestLibrary.REGISTRY_PORT);
+ TestLibrary.createRegistryOnUnusedPort();
+ int registryPort = TestLibrary.getRegistryPort(registry);
leakServer = new CheckLeaseLeak();
registry.rebind("/LeaseLeak", leakServer);
/* create a bunch of clients in a *different* vm */
for (int i = 0 ; i < ITERATIONS ; i ++ ) {
System.err.println("Created client: " + i);
JavaVM jvm = new JavaVM("LeaseLeakClient",
" -Djava.security.policy=" +
- TestParams.defaultPolicy, "");
+ TestParams.defaultPolicy +
+ " -Drmi.registry.port=" +
+ registryPort,
+ "");
jvm.start();
if (jvm.getVM().waitFor() == 1 ) {
TestLibrary.bomb("Client process failed");
}