711 |
|
new CustomTPE(poolSize, poolSize, LONG_DELAY_MS, MILLISECONDS, |
712 |
|
new ArrayBlockingQueue<Runnable>(10)); |
713 |
|
CountDownLatch threadsStarted = new CountDownLatch(poolSize); |
714 |
< |
CheckedRunnable waiter = new CheckedRunnable() { public void realRun() { |
714 |
> |
Runnable waiter = new CheckedRunnable() { public void realRun() { |
715 |
|
threadsStarted.countDown(); |
716 |
|
try { |
717 |
|
MILLISECONDS.sleep(2 * LONG_DELAY_MS); |
721 |
|
for (int i = 0; i < count; i++) |
722 |
|
p.execute(waiter); |
723 |
|
assertTrue(threadsStarted.await(LONG_DELAY_MS, MILLISECONDS)); |
724 |
+ |
assertEquals(poolSize, p.getActiveCount()); |
725 |
+ |
assertEquals(0, p.getCompletedTaskCount()); |
726 |
|
final List<Runnable> queuedTasks; |
727 |
|
try { |
728 |
|
queuedTasks = p.shutdownNow(); |
735 |
|
assertTrue(p.awaitTermination(LONG_DELAY_MS, MILLISECONDS)); |
736 |
|
assertTrue(p.isTerminated()); |
737 |
|
assertEquals(poolSize, ran.get()); |
738 |
+ |
assertEquals(poolSize, p.getCompletedTaskCount()); |
739 |
|
} |
740 |
|
|
741 |
|
// Exception Tests |