1494 |
|
final long startTime = System.nanoTime(); |
1495 |
|
assertTrue(p.isQuiescent()); |
1496 |
|
ForkJoinTask a = new CheckedRecursiveAction() { |
1497 |
< |
protected void realCompute() { |
1498 |
< |
FibAction f = new FibAction(8); |
1499 |
< |
assertSame(f, f.fork()); |
1500 |
< |
boolean t = ForkJoinTask.getPool().awaitQuiescence(MEDIUM_DELAY_MS, TimeUnit.SECONDS); |
1501 |
< |
assertTrue(t); |
1502 |
< |
while (!f.isDone()) { |
1503 |
< |
if (millisElapsedSince(startTime) > LONG_DELAY_MS) |
1504 |
< |
threadFail("timed out"); |
1505 |
< |
assertFalse(p.getAsyncMode()); |
1506 |
< |
assertFalse(p.isShutdown()); |
1507 |
< |
assertFalse(p.isTerminating()); |
1508 |
< |
assertFalse(p.isTerminated()); |
1509 |
< |
Thread.yield(); |
1510 |
< |
} |
1511 |
< |
assertFalse(p.isQuiescent()); |
1512 |
< |
assertEquals(0, ForkJoinTask.getQueuedTaskCount()); |
1513 |
< |
try { |
1514 |
< |
assertEquals(21, f.result); |
1515 |
< |
} catch (Throwable fail) { |
1516 |
< |
threadFail(fail.getMessage()); |
1517 |
< |
} |
1497 |
> |
protected void realCompute() { |
1498 |
> |
FibAction f = new FibAction(8); |
1499 |
> |
assertSame(f, f.fork()); |
1500 |
> |
boolean t = ForkJoinTask.getPool().awaitQuiescence(MEDIUM_DELAY_MS, TimeUnit.SECONDS); |
1501 |
> |
assertTrue(t); |
1502 |
> |
while (!f.isDone()) { |
1503 |
> |
if (millisElapsedSince(startTime) > LONG_DELAY_MS) |
1504 |
> |
threadFail("timed out"); |
1505 |
> |
assertFalse(p.getAsyncMode()); |
1506 |
> |
assertFalse(p.isShutdown()); |
1507 |
> |
assertFalse(p.isTerminating()); |
1508 |
> |
assertFalse(p.isTerminated()); |
1509 |
> |
Thread.yield(); |
1510 |
|
} |
1511 |
< |
}; |
1511 |
> |
assertFalse(p.isQuiescent()); |
1512 |
> |
assertEquals(0, ForkJoinTask.getQueuedTaskCount()); |
1513 |
> |
try { |
1514 |
> |
assertEquals(21, f.result); |
1515 |
> |
} catch (Throwable fail) { |
1516 |
> |
threadFail(fail.getMessage()); |
1517 |
> |
} |
1518 |
> |
}}; |
1519 |
|
p.execute(a); |
1520 |
|
while (!a.isDone() || !p.isQuiescent()) { |
1521 |
|
if (millisElapsedSince(startTime) > LONG_DELAY_MS) |