6948101: java/rmi/transport/pinLastArguments/PinLastArguments.java failing intermittently
authorsmarks
Thu, 05 Jul 2012 15:12:10 -0700
changeset 13243 71853d3335a5
parent 13161 c79204287462
child 13244 9f2c7c24a952
6948101: java/rmi/transport/pinLastArguments/PinLastArguments.java failing intermittently Reviewed-by: dholmes, smarks Contributed-by: Eric Wang <yiming.wang@oracle.com>
jdk/test/ProblemList.txt
jdk/test/java/rmi/transport/pinLastArguments/PinLastArguments.java
--- a/jdk/test/ProblemList.txt	Tue Jul 03 20:29:16 2012 -0700
+++ b/jdk/test/ProblemList.txt	Thu Jul 05 15:12:10 2012 -0700
@@ -271,9 +271,6 @@
 # 7140992
 java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency.java generic-all
 
-# 6948101
-java/rmi/transport/pinLastArguments/PinLastArguments.java	generic-all
-
 # 7146541
 java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java	linux-all
 
--- a/jdk/test/java/rmi/transport/pinLastArguments/PinLastArguments.java	Tue Jul 03 20:29:16 2012 -0700
+++ b/jdk/test/java/rmi/transport/pinLastArguments/PinLastArguments.java	Thu Jul 05 15:12:10 2012 -0700
@@ -78,10 +78,15 @@
         }
         impl = null;
 
-        System.gc();
-
-        if (ref.get() != null) {
-            throw new Error("TEST FAILED: impl not garbage collected");
+        // 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");