Skip to content

Commit

Permalink
chore(cli): named shutdown thread
Browse files Browse the repository at this point in the history
  • Loading branch information
tchiotludo committed Mar 1, 2022
1 parent e164927 commit 82e64c5
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions cli/src/main/java/io/kestra/cli/AbstractCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,18 @@ private void startWebserver() {
}

protected void shutdownHook(Rethrow.RunnableChecked<Exception> run) {
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
log.warn("Receiving shutdown ! Try to graceful exit");

try {
run.run();
} catch (Exception e) {
log.error("Failed to close gracefully!", e);
}
}));
Runtime.getRuntime().addShutdownHook(new Thread(
() -> {
log.warn("Receiving shutdown ! Try to graceful exit");

try {
run.run();
} catch (Exception e) {
log.error("Failed to close gracefully!", e);
}
},
"command-shutdown"
));
}

@SuppressWarnings({"unused"})
Expand Down

0 comments on commit 82e64c5

Please sign in to comment.