Hi All,

Please help to review the fix attached for test bug 6948101 <http://monaco.us.oracle.com/detail.jsf?cr=6948101> which is same root cause as bug 7123972 <http://monaco.us.oracle.com/detail.jsf?cr=7123972>. The test makes wrong assumption that GC is started immediately to recycle unused objects after System.gc() called. The proposed fix is to make sure objects have been recycled by GC before checking if the weak reference is null.

Regards,
Eric
--- old/test/ProblemList.txt    2012-06-26 17:02:12.934138771 +0800
+++ new/test/ProblemList.txt    2012-06-26 17:02:11.494051649 +0800
@@ -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
 
--- old/test/java/rmi/transport/pinLastArguments/PinLastArguments.java  
2012-06-26 17:02:17.432074905 +0800
+++ new/test/java/rmi/transport/pinLastArguments/PinLastArguments.java  
2012-06-26 17:02:15.984073307 +0800
@@ -43,7 +43,8 @@
 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;
     }
@@ -53,6 +54,9 @@
         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 {
@@ -78,7 +82,11 @@
         }
         impl = null;
 
-        System.gc();
+        while(!finalized) {
+            System.gc();
+            System.runFinalization();
+            Thread.sleep(20);
+        }
 
         if (ref.get() != null) {
             throw new Error("TEST FAILED: impl not garbage collected");

Reply via email to