2081 |
|
} |
2082 |
|
} |
2083 |
|
|
2084 |
+ |
public void testAbortPolicy() { |
2085 |
+ |
final RejectedExecutionHandler handler = |
2086 |
+ |
new ThreadPoolExecutor.AbortPolicy(); |
2087 |
+ |
final ThreadPoolExecutor p = |
2088 |
+ |
new ThreadPoolExecutor(1, 1, |
2089 |
+ |
LONG_DELAY_MS, MILLISECONDS, |
2090 |
+ |
new ArrayBlockingQueue<Runnable>(10)); |
2091 |
+ |
final TrackedNoOpRunnable r = new TrackedNoOpRunnable(); |
2092 |
+ |
try { |
2093 |
+ |
handler.rejectedExecution(r, p); |
2094 |
+ |
shouldThrow(); |
2095 |
+ |
} catch (RejectedExecutionException success) {} |
2096 |
+ |
assertFalse(r.done); |
2097 |
+ |
assertEquals(0, p.getTaskCount()); |
2098 |
+ |
assertTrue(p.getQueue().isEmpty()); |
2099 |
+ |
} |
2100 |
+ |
|
2101 |
|
} |