8166057: [testbug] CoreThreadTimeOut still uses hardcoded timeout

Reviewed-by: martin, chegar, shade
This commit is contained in:
Doug Lea 2016-09-23 13:18:22 -07:00
parent 9496149e05
commit c9f268cc15

@ -83,15 +83,18 @@ public class CoreThreadTimeOut {
tpe.allowCoreThreadTimeOut(true);
check(tpe.allowsCoreThreadTimeOut());
equal(countExecutorThreads(), 0);
long t0 = System.nanoTime();
for (int i = 0; i < threadCount; i++)
tpe.submit(new Runnable() { public void run() {}});
int count = countExecutorThreads();
if (millisElapsedSince(t0) < timeoutMillis)
equal(count, threadCount);
long startTime = System.nanoTime();
for (int i = 0; i < threadCount; i++) {
tpe.submit(() -> {});
int count = countExecutorThreads();
if (millisElapsedSince(startTime) < timeoutMillis)
equal(count, i + 1);
}
while (countExecutorThreads() > 0 &&
millisElapsedSince(t0) < 10 * 1000);
millisElapsedSince(startTime) < LONG_DELAY_MS)
Thread.yield();
equal(countExecutorThreads(), 0);
check(millisElapsedSince(startTime) >= timeoutMillis);
tpe.shutdown();
check(tpe.allowsCoreThreadTimeOut());
check(tpe.awaitTermination(LONG_DELAY_MS, MILLISECONDS));