Skip to content

Commit 7603d03

Browse files
committed
fix
1 parent 283d464 commit 7603d03

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ExecutorServiceManager.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,16 @@ private void doStop() {
7676
try {
7777
log.debug("Closing executor");
7878
executor.shutdown();
79-
workflowExecutor.shutdown();
80-
if (!executor.awaitTermination(terminationTimeoutSeconds, TimeUnit.SECONDS)) {
81-
executor.shutdownNow(); // if we timed out, waiting, cancel everything
79+
if (workflowExecutor != null) {
80+
workflowExecutor.shutdown();
81+
if (!workflowExecutor.awaitTermination(terminationTimeoutSeconds, TimeUnit.SECONDS)) {
82+
workflowExecutor.shutdownNow(); // if we timed out, waiting, cancel everything
83+
}
8284
}
83-
if (!workflowExecutor.awaitTermination(terminationTimeoutSeconds, TimeUnit.SECONDS)) {
85+
if (!executor.awaitTermination(terminationTimeoutSeconds, TimeUnit.SECONDS)) {
8486
executor.shutdownNow(); // if we timed out, waiting, cancel everything
8587
}
88+
8689
} catch (InterruptedException e) {
8790
log.debug("Exception closing executor: {}", e.getLocalizedMessage());
8891
}

0 commit comments

Comments
 (0)