diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/ThreadExecutors.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/ThreadExecutors.java index 0484c80ed8eb..394e4e4aa0e6 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/ThreadExecutors.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/ThreadExecutors.java @@ -5,7 +5,9 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +import java.util.logging.Level; final class ThreadExecutors { private final EnsoContext context; @@ -32,6 +34,17 @@ public void shutdown() { while (it.hasNext()) { var p = it.next().getKey(); p.shutdown(); + boolean success; + try { + success = p.awaitTermination(10, TimeUnit.SECONDS); + } catch (InterruptedException ex) { + success = false; + } + if (!success) { + context + .getLogger() + .log(Level.WARNING, "Cannot shutdown {0} thread pool", it.next().getValue()); + } } }