1024 |
|
* get of submitted callable throws InterruptedException if interrupted |
1025 |
|
*/ |
1026 |
|
public void testInterruptedSubmit() throws InterruptedException { |
1027 |
+ |
final CountDownLatch done = new CountDownLatch(1); |
1028 |
|
final ThreadPoolExecutor p = |
1029 |
|
new ThreadPoolExecutor(1, 1, |
1030 |
|
60, SECONDS, |
1031 |
|
new ArrayBlockingQueue<Runnable>(10)); |
1032 |
|
|
1033 |
< |
try (PoolCleaner cleaner = cleaner(p)) { |
1033 |
> |
try (PoolCleaner cleaner = cleaner(p, done)) { |
1034 |
|
final CountDownLatch threadStarted = new CountDownLatch(1); |
1034 |
– |
final CountDownLatch done = new CountDownLatch(1); |
1035 |
|
Thread t = newStartedThread(new CheckedInterruptedRunnable() { |
1036 |
|
public void realRun() throws Exception { |
1037 |
|
Callable task = new CheckedCallable<Boolean>() { |
1043 |
|
p.submit(task).get(); |
1044 |
|
}}); |
1045 |
|
|
1046 |
< |
assertTrue(threadStarted.await(LONG_DELAY_MS, MILLISECONDS)); |
1046 |
> |
await(threadStarted); |
1047 |
|
t.interrupt(); |
1048 |
< |
awaitTermination(t, MEDIUM_DELAY_MS); |
1049 |
< |
done.countDown(); |
1048 |
> |
awaitTermination(t); |
1049 |
|
} |
1050 |
|
} |
1051 |
|
|