Open AlecGoncharow opened 4 years ago
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
try {
Thread.sleep(200);
System.out.println("Shutting down ...");
//some cleaning up code...
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
e.printStackTrace();
}
}
});
18b7c47188a5053d61f8bca1c40dff5c95100df0
Should help addressing this issue. Without the runtime shutdown hook it seemed like the terminateNetwork()
function was never actually being hit.
https://github.com/BridgesUNCC/bridges-java/blob/6c8ee5e0805c99715ee78d0588e8a622313eab15/src/main/java/bridges/games/NonBlockingGame.java#L232
https://stackoverflow.com/questions/1611931/catching-ctrlc-in-java