418 |
|
public void realRun() throws InterruptedException { |
419 |
|
threadStarted.countDown(); |
420 |
|
assertEquals(0, p.getCompletedTaskCount()); |
421 |
< |
threadProceed.await(); |
421 |
> |
await(threadProceed); |
422 |
|
threadDone.countDown(); |
423 |
|
}}); |
424 |
|
await(threadStarted); |
425 |
|
assertEquals(0, p.getCompletedTaskCount()); |
426 |
|
threadProceed.countDown(); |
427 |
< |
threadDone.await(); |
427 |
> |
await(threadDone); |
428 |
|
long startTime = System.nanoTime(); |
429 |
|
while (p.getCompletedTaskCount() != 1) { |
430 |
|
if (millisElapsedSince(startTime) > LONG_DELAY_MS) |
814 |
|
Runnable task = new CheckedRunnable() { public void realRun() |
815 |
|
throws InterruptedException { |
816 |
|
poolBlocked.countDown(); |
817 |
< |
assertTrue(unblock.await(LONG_DELAY_MS, MILLISECONDS)); |
817 |
> |
await(unblock); |
818 |
|
ran.getAndIncrement(); |
819 |
|
}}; |
820 |
|
List<Future<?>> blockers = new ArrayList<>(); |
822 |
|
List<Future<?>> delayeds = new ArrayList<>(); |
823 |
|
for (int i = 0; i < poolSize; i++) |
824 |
|
blockers.add(p.submit(task)); |
825 |
< |
assertTrue(poolBlocked.await(LONG_DELAY_MS, MILLISECONDS)); |
825 |
> |
await(poolBlocked); |
826 |
|
|
827 |
|
periodics.add(p.scheduleAtFixedRate(countDowner(periodicLatch1), |
828 |
|
1, 1, MILLISECONDS)); |
858 |
|
} |
859 |
|
} |
860 |
|
if (effectivePeriodicPolicy) { |
861 |
< |
assertTrue(periodicLatch1.await(LONG_DELAY_MS, MILLISECONDS)); |
862 |
< |
assertTrue(periodicLatch2.await(LONG_DELAY_MS, MILLISECONDS)); |
861 |
> |
await(periodicLatch1); |
862 |
> |
await(periodicLatch2); |
863 |
|
for (Future<?> periodic : periodics) { |
864 |
|
assertTrue(periodic.cancel(false)); |
865 |
|
assertTrue(periodic.isCancelled()); |