Skip to content

Commit

Permalink
apply shutdown hook to airbyte server to allow graceful termination (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaohansong authored Aug 24, 2022
1 parent 6f09860 commit 883d0ee
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions airbyte-server/src/main/java/io/airbyte/server/ServerApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,15 @@ public void start() throws Exception {
final String banner = MoreResources.readResource("banner/banner.txt");
LOGGER.info(banner + String.format("Version: %s\n", airbyteVersion.serialize()));
server.join();

Runtime.getRuntime().addShutdownHook(new Thread(() -> {
try {
server.stop();
} catch (Exception ex) {
// silently fail at this stage because server is terminating.
LOGGER.warn("exception: " + ex);
}
}));
}

private static void assertDatabasesReady(final Configs configs,
Expand Down

0 comments on commit 883d0ee

Please sign in to comment.