changeset 5808:f49ee844919f

6948101: java/rmi/transport/pinLastArguments/PinLastArguments.java failing intermittently Reviewed-by: dholmes, smarks Contributed-by: Eric Wang <yiming.wang@oracle.com>
author dmocek
date Sat, 08 Sep 2012 00:03:36 -0700
parents c9c183914982
children 06bf002467f4
files test/ProblemList.txt test/java/rmi/transport/pinLastArguments/PinLastArguments.java
diffstat 2 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/test/ProblemList.txt	Fri Jul 27 16:53:15 2012 -0700
+++ b/test/ProblemList.txt	Sat Sep 08 00:03:36 2012 -0700
@@ -336,9 +336,6 @@
 # Registry already running on port, solaris
 java/rmi/Naming/legalRegistryNames/LegalRegistryNames.java      generic-all
 
-# Fails on Linux 32 and 64bit -server?, impl not garbage collected???
-java/rmi/transport/pinLastArguments/PinLastArguments.java       generic-all
-
 # 7146541
 java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java	linux-all
 
--- a/test/java/rmi/transport/pinLastArguments/PinLastArguments.java	Fri Jul 27 16:53:15 2012 -0700
+++ b/test/java/rmi/transport/pinLastArguments/PinLastArguments.java	Sat Sep 08 00:03:36 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");