7057320: test/java/util/concurrent/Executors/AutoShutdown.java failing intermittently
authordl
Wed, 13 Jul 2011 12:24:56 +0100
changeset 10119 277fd8d9fcda
parent 10118 c22b087661be
child 10120 540429c5db45
7057320: test/java/util/concurrent/Executors/AutoShutdown.java failing intermittently Summary: Add retry/timeout for checking activeCount Reviewed-by: chegar
jdk/test/java/util/concurrent/Executors/AutoShutdown.java
--- a/jdk/test/java/util/concurrent/Executors/AutoShutdown.java	Tue Jul 12 10:28:37 2011 -0700
+++ b/jdk/test/java/util/concurrent/Executors/AutoShutdown.java	Wed Jul 13 12:24:56 2011 +0100
@@ -67,6 +67,11 @@
         e1 = e2 = null;
         for (int i = 0; i < 10 && Thread.activeCount() > count0; i++)
             tryWaitForFinalizersToRun();
+        for (int i = 0; i < 10; ++i) { // give JVM a chance to settle.
+            if (Thread.activeCount() == count0)
+                return;
+            Thread.sleep(1000);
+        }
         equal(Thread.activeCount(), count0);
     }