1236 |
|
* execute throws RejectedExecutionException if shutdown |
1237 |
|
*/ |
1238 |
|
public void testRejectedExecutionExceptionOnShutdown() { |
1239 |
< |
ThreadPoolExecutor p = |
1240 |
< |
new CustomTPE(1,1,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue<Runnable>(1)); |
1239 |
> |
final ThreadPoolExecutor p = |
1240 |
> |
new CustomTPE(1, 1, |
1241 |
> |
LONG_DELAY_MS, MILLISECONDS, |
1242 |
> |
new ArrayBlockingQueue<Runnable>(1)); |
1243 |
|
try { p.shutdown(); } catch (SecurityException ok) { return; } |
1244 |
< |
try { |
1245 |
< |
p.execute(new NoOpRunnable()); |
1246 |
< |
shouldThrow(); |
1247 |
< |
} catch (RejectedExecutionException success) {} |
1248 |
< |
|
1249 |
< |
joinPool(p); |
1244 |
> |
try (PoolCleaner cleaner = cleaner(p)) { |
1245 |
> |
try { |
1246 |
> |
p.execute(new NoOpRunnable()); |
1247 |
> |
shouldThrow(); |
1248 |
> |
} catch (RejectedExecutionException success) {} |
1249 |
> |
} |
1250 |
|
} |
1251 |
|
|
1252 |
|
/** |