only force shutdown on cached threadpool if its not the same as the execture service
This commit is contained in:
parent
42e8567477
commit
e313379ed5
|
@ -89,10 +89,8 @@ public abstract class AbstractThreadPool extends AbstractComponent implements Th
|
|||
logger.debug("shutting down {} thread pool", getType());
|
||||
executorService.shutdown();
|
||||
scheduledExecutorService.shutdown();
|
||||
if (!cached.isShutdown()) {
|
||||
cached.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void shutdownNow() {
|
||||
started = false;
|
||||
|
@ -102,14 +100,18 @@ public abstract class AbstractThreadPool extends AbstractComponent implements Th
|
|||
if (!scheduledExecutorService.isTerminated()) {
|
||||
scheduledExecutorService.shutdownNow();
|
||||
}
|
||||
if (cached != executorService) {
|
||||
if (!cached.isTerminated()) {
|
||||
cached.shutdownNow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
|
||||
boolean result = executorService.awaitTermination(timeout, unit);
|
||||
if (cached != executorService) {
|
||||
result &= cached.awaitTermination(timeout, unit);
|
||||
}
|
||||
result &= scheduledExecutorService.awaitTermination(timeout, unit);
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue