1043 |
|
* execute throws RejectedExecutionException if saturated. |
1044 |
|
*/ |
1045 |
|
public void testSaturatedExecute() { |
1046 |
< |
ThreadPoolExecutor p = |
1046 |
> |
final ThreadPoolExecutor p = |
1047 |
|
new ThreadPoolExecutor(1, 1, |
1048 |
|
LONG_DELAY_MS, MILLISECONDS, |
1049 |
|
new ArrayBlockingQueue<Runnable>(1)); |
1050 |
< |
final CountDownLatch done = new CountDownLatch(1); |
1051 |
< |
try { |
1050 |
> |
try (PoolCleaner cleaner = cleaner(p)) { |
1051 |
> |
final CountDownLatch done = new CountDownLatch(1); |
1052 |
|
Runnable task = new CheckedRunnable() { |
1053 |
|
public void realRun() throws InterruptedException { |
1054 |
|
done.await(); |
1062 |
|
} catch (RejectedExecutionException success) {} |
1063 |
|
assertTrue(p.getTaskCount() <= 2); |
1064 |
|
} |
1065 |
– |
} finally { |
1065 |
|
done.countDown(); |
1067 |
– |
joinPool(p); |
1066 |
|
} |
1067 |
|
} |
1068 |
|
|