Skip to content

Commit 09bd45c

Browse files
metacosmcsviri
authored andcommitted
fix: re-interrupt thread on InterruptedException
1 parent 47a8891 commit 09bd45c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,10 @@ public static void executeAndWaitForCompletion(Runnable task, String threadNameP
9090
.get(ConfigurationServiceProvider.instance().cacheSyncTimeout().toSeconds(),
9191
TimeUnit.SECONDS);
9292
shutdown(instrumented);
93-
} catch (InterruptedException | ExecutionException | TimeoutException e) {
93+
} catch (InterruptedException e) {
94+
thread.interrupt();
95+
throw new OperatorException("Couldn't execute task", e);
96+
} catch (ExecutionException | TimeoutException e) {
9497
throw new OperatorException("Couldn't execute task", e);
9598
} finally {
9699
// restore original name
@@ -105,6 +108,7 @@ private void doStop() {
105108
shutdown(workflowExecutor);
106109
} catch (InterruptedException e) {
107110
log.debug("Exception closing executor: {}", e.getLocalizedMessage());
111+
Thread.currentThread().interrupt();
108112
}
109113
}
110114

0 commit comments

Comments
 (0)