Skip to content

Commit

Permalink
Add shutdown hook to Launch class
Browse files Browse the repository at this point in the history
  • Loading branch information
scroix committed Apr 7, 2024
1 parent e7099e7 commit 4a022b9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions nodel-jyhost/src/main/java/org/nodel/jyhost/Launch.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ public static void main(String[] args) throws IOException, JSONException, Startu
System.out.println("Press Enter to initiate a shutdown.");
System.out.println();

// Add shutdown hook
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
System.out.println("Received termination signal. Shutting down...");
launch.shutdown();
System.out.println("Finished.");
}));

tryReadFromConsole();

System.out.println("Shutdown initiated...");
Expand Down

0 comments on commit 4a022b9

Please sign in to comment.