[Minor] code cleanup

This commit is contained in:
Robert von Burg 2023-04-17 11:49:25 +02:00
parent 5f72b05a86
commit dea49d871f
Signed by: eitch
GPG Key ID: 75DB9C85C74331F7
1 changed files with 3 additions and 12 deletions

View File

@ -42,21 +42,12 @@ public class ExecutorPool {
}
public void destroy() {
for (String poolName : this.executors.keySet()) {
logger.info("Shutting down executor pool " + poolName);
ExecutorService executor = this.executors.get(poolName);
shutdownExecutor(poolName, executor);
}
for (String poolName : this.scheduledExecutors.keySet()) {
logger.info("Shutting down scheduled executor pool " + poolName);
ExecutorService executor = this.scheduledExecutors.get(poolName);
shutdownExecutor(poolName, executor);
}
this.executors.forEach(this::shutdownExecutor);
this.scheduledExecutors.forEach(this::shutdownExecutor);
}
private void shutdownExecutor(String name, ExecutorService executor) {
logger.info("Shutting down executor pool " + name);
try {
List<Runnable> tasks = executor.shutdownNow();
if (!tasks.isEmpty()) {