7057320: test/java/util/concurrent/Executors/AutoShutdown.java failing intermittently

Add retry/timeout for checking activeCount

Reviewed-by: chegar
This commit is contained in:
Doug Lea 2011-07-13 12:24:56 +01:00
parent e3c0616ac7
commit 517763ddf1

View File

@ -67,6 +67,11 @@ public class AutoShutdown {
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);
}