1124 |
|
* execute throws RejectedExecutionException if saturated. |
1125 |
|
*/ |
1126 |
|
public void testSaturatedExecute() { |
1127 |
< |
ThreadPoolExecutor p = |
1127 |
> |
final ThreadPoolExecutor p = |
1128 |
|
new CustomTPE(1, 1, |
1129 |
|
LONG_DELAY_MS, MILLISECONDS, |
1130 |
|
new ArrayBlockingQueue<Runnable>(1)); |
1131 |
< |
final CountDownLatch done = new CountDownLatch(1); |
1132 |
< |
try { |
1131 |
> |
try (PoolCleaner cleaner = cleaner(p)) { |
1132 |
> |
final CountDownLatch done = new CountDownLatch(1); |
1133 |
|
Runnable task = new CheckedRunnable() { |
1134 |
|
public void realRun() throws InterruptedException { |
1135 |
|
done.await(); |
1143 |
|
} catch (RejectedExecutionException success) {} |
1144 |
|
assertTrue(p.getTaskCount() <= 2); |
1145 |
|
} |
1146 |
– |
} finally { |
1146 |
|
done.countDown(); |
1148 |
– |
joinPool(p); |
1147 |
|
} |
1148 |
|
} |
1149 |
|
|