260 |
|
public void realRun() throws InterruptedException { |
261 |
|
threadStarted.countDown(); |
262 |
|
assertEquals(1, p.getActiveCount()); |
263 |
< |
done.await(); |
263 |
> |
await(done); |
264 |
|
}}); |
265 |
< |
assertTrue(threadStarted.await(LONG_DELAY_MS, MILLISECONDS)); |
265 |
> |
await(threadStarted); |
266 |
|
assertEquals(1, p.getActiveCount()); |
267 |
|
done.countDown(); |
268 |
|
} |
488 |
|
p.execute(new CheckedRunnable() { |
489 |
|
public void realRun() throws InterruptedException { |
490 |
|
threadsStarted.countDown(); |
491 |
< |
done.await(); |
491 |
> |
await(done); |
492 |
|
assertEquals(THREADS, p.getLargestPoolSize()); |
493 |
|
}}); |
494 |
< |
assertTrue(threadsStarted.await(LONG_DELAY_MS, MILLISECONDS)); |
494 |
> |
await(threadsStarted); |
495 |
|
assertEquals(THREADS, p.getLargestPoolSize()); |
496 |
|
} |
497 |
|
assertEquals(THREADS, p.getLargestPoolSize()); |
532 |
|
public void realRun() throws InterruptedException { |
533 |
|
threadStarted.countDown(); |
534 |
|
assertEquals(1, p.getPoolSize()); |
535 |
< |
done.await(); |
535 |
> |
await(done); |
536 |
|
}}); |
537 |
< |
assertTrue(threadStarted.await(LONG_DELAY_MS, MILLISECONDS)); |
537 |
> |
await(threadStarted); |
538 |
|
assertEquals(1, p.getPoolSize()); |
539 |
|
} |
540 |
|
} |
556 |
|
p.execute(new CheckedRunnable() { |
557 |
|
public void realRun() throws InterruptedException { |
558 |
|
threadStarted.countDown(); |
559 |
< |
done.await(); |
559 |
> |
await(done); |
560 |
|
}}); |
561 |
< |
assertTrue(threadStarted.await(LONG_DELAY_MS, MILLISECONDS)); |
561 |
> |
await(threadStarted); |
562 |
|
assertEquals(1, p.getTaskCount()); |
563 |
|
assertEquals(0, p.getCompletedTaskCount()); |
564 |
|
for (int i = 0; i < TASKS; i++) { |
567 |
|
public void realRun() throws InterruptedException { |
568 |
|
threadStarted.countDown(); |
569 |
|
assertEquals(1 + TASKS, p.getTaskCount()); |
570 |
< |
done.await(); |
570 |
> |
await(done); |
571 |
|
}}); |
572 |
|
} |
573 |
|
assertEquals(1 + TASKS, p.getTaskCount()); |
608 |
|
public void realRun() throws InterruptedException { |
609 |
|
assertFalse(p.isTerminating()); |
610 |
|
threadStarted.countDown(); |
611 |
< |
done.await(); |
611 |
> |
await(done); |
612 |
|
}}); |
613 |
< |
assertTrue(threadStarted.await(LONG_DELAY_MS, MILLISECONDS)); |
613 |
> |
await(threadStarted); |
614 |
|
assertFalse(p.isTerminating()); |
615 |
|
done.countDown(); |
616 |
|
try { p.shutdown(); } catch (SecurityException ok) { return; } |
636 |
|
public void realRun() throws InterruptedException { |
637 |
|
assertFalse(p.isTerminating()); |
638 |
|
threadStarted.countDown(); |
639 |
< |
done.await(); |
639 |
> |
await(done); |
640 |
|
}}); |
641 |
< |
assertTrue(threadStarted.await(LONG_DELAY_MS, MILLISECONDS)); |
641 |
> |
await(threadStarted); |
642 |
|
assertFalse(p.isTerminating()); |
643 |
|
done.countDown(); |
644 |
|
try { p.shutdown(); } catch (SecurityException ok) { return; } |
666 |
|
public Boolean realCall() throws InterruptedException { |
667 |
|
threadStarted.countDown(); |
668 |
|
assertSame(q, p.getQueue()); |
669 |
< |
done.await(); |
669 |
> |
await(done); |
670 |
|
return Boolean.TRUE; |
671 |
|
}}; |
672 |
|
tasks[i] = new FutureTask(task); |
673 |
|
p.execute(tasks[i]); |
674 |
|
} |
675 |
< |
assertTrue(threadStarted.await(LONG_DELAY_MS, MILLISECONDS)); |
675 |
> |
await(threadStarted); |
676 |
|
assertSame(q, p.getQueue()); |
677 |
|
assertFalse(q.contains(tasks[0])); |
678 |
|
assertTrue(q.contains(tasks[tasks.length - 1])); |
698 |
|
tasks[i] = new CheckedRunnable() { |
699 |
|
public void realRun() throws InterruptedException { |
700 |
|
threadStarted.countDown(); |
701 |
< |
done.await(); |
701 |
> |
await(done); |
702 |
|
}}; |
703 |
|
p.execute(tasks[i]); |
704 |
|
} |
705 |
< |
assertTrue(threadStarted.await(LONG_DELAY_MS, MILLISECONDS)); |
705 |
> |
await(threadStarted); |
706 |
|
assertFalse(p.remove(tasks[0])); |
707 |
|
assertTrue(q.contains(tasks[4])); |
708 |
|
assertTrue(q.contains(tasks[3])); |
733 |
|
Callable task = new CheckedCallable<Boolean>() { |
734 |
|
public Boolean realCall() throws InterruptedException { |
735 |
|
threadStarted.countDown(); |
736 |
< |
done.await(); |
736 |
> |
await(done); |
737 |
|
return Boolean.TRUE; |
738 |
|
}}; |
739 |
|
tasks[i] = new FutureTask(task); |
740 |
|
p.execute(tasks[i]); |
741 |
|
} |
742 |
< |
assertTrue(threadStarted.await(LONG_DELAY_MS, MILLISECONDS)); |
742 |
> |
await(threadStarted); |
743 |
|
assertEquals(tasks.length, p.getTaskCount()); |
744 |
|
assertEquals(tasks.length - 1, q.size()); |
745 |
|
assertEquals(1L, p.getActiveCount()); |
777 |
|
}}; |
778 |
|
for (int i = 0; i < count; i++) |
779 |
|
p.execute(waiter); |
780 |
< |
assertTrue(threadsStarted.await(LONG_DELAY_MS, MILLISECONDS)); |
780 |
> |
await(threadsStarted); |
781 |
|
assertEquals(poolSize, p.getActiveCount()); |
782 |
|
assertEquals(0, p.getCompletedTaskCount()); |
783 |
|
final List<Runnable> queuedTasks; |
1144 |
|
final CountDownLatch done = new CountDownLatch(1); |
1145 |
|
Runnable task = new CheckedRunnable() { |
1146 |
|
public void realRun() throws InterruptedException { |
1147 |
< |
done.await(); |
1147 |
> |
await(done); |
1148 |
|
}}; |
1149 |
|
for (int i = 0; i < 2; ++i) |
1150 |
|
p.execute(task); |
1172 |
|
final CountDownLatch done = new CountDownLatch(1); |
1173 |
|
Runnable blocker = new CheckedRunnable() { |
1174 |
|
public void realRun() throws InterruptedException { |
1175 |
< |
done.await(); |
1175 |
> |
await(done); |
1176 |
|
}}; |
1177 |
|
p.execute(blocker); |
1178 |
|
TrackedNoOpRunnable[] tasks = new TrackedNoOpRunnable[5]; |
2012 |
|
}}; |
2013 |
|
futures.add(e.submit(r)); |
2014 |
|
} |
2015 |
< |
assertTrue(blockerStarted.await(LONG_DELAY_MS, MILLISECONDS)); |
2015 |
> |
await(blockerStarted); |
2016 |
|
for (Future<?> future : futures) future.cancel(false); |
2017 |
|
for (Future<?> future : futures) { |
2018 |
|
try { |