test/java/rmi/transport/pinLastArguments/PinLastArguments.java

Print this page

        

*** 41,60 **** --- 41,64 ---- import java.rmi.Remote; import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; public class PinLastArguments { + private static volatile boolean finalized = false; public interface Ping extends Remote { void ping(Object first, Object second) throws RemoteException; } private static class PingImpl implements Ping { PingImpl() { } public void ping(Object first, Object second) { System.err.println("ping invoked: " + first + ", " + second); } + protected void finalize() { + finalized = true; + } } public static void main(String[] args) throws Exception { System.err.println("\nRegression test for bug 6332349\n");
*** 76,86 **** --- 80,94 ---- } finally { UnicastRemoteObject.unexportObject(impl, true); } impl = null; + while(!finalized) { System.gc(); + System.runFinalization(); + Thread.sleep(20); + } if (ref.get() != null) { throw new Error("TEST FAILED: impl not garbage collected"); }