changeset 5307:36e966571ab8

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 f94f01ee84b7
children 219367401fe5
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 Sep 07 22:19:21 2012 +0400
+++ b/test/ProblemList.txt	Sat Sep 08 00:03:36 2012 -0700
@@ -474,9 +474,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 Sep 07 22:19:21 2012 +0400
+++ 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");