Shut down more gracefully (hopefully)

This commit is contained in:
0xboobface 2018-12-14 17:43:38 +01:00
parent c7e07b4b26
commit 75ab95e1ea
1 changed files with 7 additions and 3 deletions

View File

@ -178,9 +178,13 @@ public class CamrecApplication extends Application {
try {
Config.getInstance().save();
LOG.info("Shutdown complete. Goodbye!");
Platform.exit();
// This is needed, because OkHttp?! seems to block the shutdown with its writer threads. They are not daemon threads :(
System.exit(0);
Platform.runLater(() -> {
primaryStage.close();
shutdownInfo.close();
Platform.exit();
// This is needed, because OkHttp?! seems to block the shutdown with its writer threads. They are not daemon threads :(
System.exit(0);
});
} catch (IOException e1) {
Platform.runLater(() -> {
Alert alert = new AutosizeAlert(Alert.AlertType.ERROR);