Skip to content

Commit 3ea4412

Browse files
committed
fix: call shutdownNow if we timed out waiting for threads to finish
1 parent 940b0cd commit 3ea4412

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/DefaultEventHandler.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ public void close() {
9191
try {
9292
log.debug("Closing handler for {}", controllerName);
9393
executor.shutdown();
94-
executor.awaitTermination(terminationTimeout, TimeUnit.SECONDS);
94+
if (!executor.awaitTermination(terminationTimeout, TimeUnit.SECONDS)) {
95+
executor.shutdownNow(); // if we timed out, waiting, cancel everything
96+
}
9597
} catch (InterruptedException e) {
9698
log.debug("Exception closing handler for {}: {}", controllerName, e.getLocalizedMessage());
9799
}

0 commit comments

Comments
 (0)