in src/main/java/org/apache/sling/commons/threads/impl/DefaultThreadPool.java [235:259]
public void shutdown() {
this.logger.info("Shutting down thread pool [{}] ...", name);
if ( this.executor != null ) {
if (this.configuration.isShutdownGraceful()) {
this.executor.shutdown();
} else {
this.executor.shutdownNow();
}
try {
if (this.configuration.getShutdownWaitTimeMs() > 0) {
if (!this.executor.awaitTermination(this.configuration.getShutdownWaitTimeMs(), TimeUnit.MILLISECONDS)) {
logger.warn("Running commands have not terminated within "
+ this.configuration.getShutdownWaitTimeMs()
+ "ms. Will shut them down by interruption");
this.executor.shutdownNow(); // TODO: shouldn't this be outside the if statement?!
}
}
} catch (final InterruptedException ie) {
this.logger.error("Cannot shutdown thread pool [" + this.name + "]", ie);
}
this.executor = null;
}
this.logger.info("Thread pool [{}] is shut down.", this.name);
}