279 |
|
Executors.newScheduledThreadPool(2), |
280 |
|
}; |
281 |
|
|
282 |
< |
final Runnable sleeper = new CheckedInterruptedRunnable() { |
282 |
> |
final Runnable sleeper = new CheckedRunnable() { |
283 |
|
public void realRun() throws InterruptedException { |
284 |
< |
delay(LONG_DELAY_MS); |
284 |
> |
try { |
285 |
> |
delay(LONG_DELAY_MS); |
286 |
> |
} catch(InterruptedException OK) { |
287 |
> |
} |
288 |
|
}}; |
289 |
|
|
290 |
|
List<Thread> threads = new ArrayList<>(); |
298 |
|
for (Thread thread : threads) |
299 |
|
awaitTermination(thread); |
300 |
|
for (ExecutorService executor : executors) |
301 |
+ |
executor.shutdownNow(); // assumes shutdownNow interrupts threads |
302 |
+ |
for (ExecutorService executor : executors) |
303 |
|
joinPool(executor); |
304 |
|
} |
305 |
|
|