50 |
|
final Runnable task = new CheckedRunnable() { |
51 |
|
public void realRun() { done.countDown(); }}; |
52 |
|
p.execute(task); |
53 |
< |
assertTrue(done.await(LONG_DELAY_MS, MILLISECONDS)); |
53 |
> |
await(done); |
54 |
|
} |
55 |
|
} |
56 |
|
|
362 |
|
public void realRun() throws InterruptedException { |
363 |
|
threadStarted.countDown(); |
364 |
|
assertEquals(0, p.getCompletedTaskCount()); |
365 |
< |
threadProceed.await(); |
365 |
> |
await(threadProceed); |
366 |
|
threadDone.countDown(); |
367 |
|
}}); |
368 |
|
await(threadStarted); |
369 |
|
assertEquals(0, p.getCompletedTaskCount()); |
370 |
|
threadProceed.countDown(); |
371 |
< |
threadDone.await(); |
371 |
> |
await(threadDone); |
372 |
|
long startTime = System.nanoTime(); |
373 |
|
while (p.getCompletedTaskCount() != 1) { |
374 |
|
if (millisElapsedSince(startTime) > LONG_DELAY_MS) |
773 |
|
Runnable task = new CheckedRunnable() { public void realRun() |
774 |
|
throws InterruptedException { |
775 |
|
poolBlocked.countDown(); |
776 |
< |
assertTrue(unblock.await(LONG_DELAY_MS, MILLISECONDS)); |
776 |
> |
await(unblock); |
777 |
|
ran.getAndIncrement(); |
778 |
|
}}; |
779 |
|
List<Future<?>> blockers = new ArrayList<>(); |
781 |
|
List<Future<?>> delayeds = new ArrayList<>(); |
782 |
|
for (int i = 0; i < poolSize; i++) |
783 |
|
blockers.add(p.submit(task)); |
784 |
< |
assertTrue(poolBlocked.await(LONG_DELAY_MS, MILLISECONDS)); |
784 |
> |
await(poolBlocked); |
785 |
|
|
786 |
|
periodics.add(p.scheduleAtFixedRate(countDowner(periodicLatch1), |
787 |
|
1, 1, MILLISECONDS)); |
817 |
|
} |
818 |
|
} |
819 |
|
if (effectivePeriodicPolicy) { |
820 |
< |
assertTrue(periodicLatch1.await(LONG_DELAY_MS, MILLISECONDS)); |
821 |
< |
assertTrue(periodicLatch2.await(LONG_DELAY_MS, MILLISECONDS)); |
820 |
> |
await(periodicLatch1); |
821 |
> |
await(periodicLatch2); |
822 |
|
for (Future<?> periodic : periodics) { |
823 |
|
assertTrue(periodic.cancel(false)); |
824 |
|
assertTrue(periodic.isCancelled()); |