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

Print this page

        

*** 76,89 **** } finally { UnicastRemoteObject.unexportObject(impl, true); } impl = null; System.gc(); ! ! if (ref.get() != null) { ! throw new Error("TEST FAILED: impl not garbage collected"); } System.err.println("TEST PASSED"); } } --- 76,94 ---- } finally { UnicastRemoteObject.unexportObject(impl, true); } impl = null; + // Might require multiple calls to System.gc() for weak-references + // processing to be complete. If the weak-reference is not cleared as + // expected we will hang here until timed out by the test harness. + while (true) { System.gc(); ! Thread.sleep(20); ! if(ref.get() == null) { ! break; ! } } System.err.println("TEST PASSED"); } }