From: Hannu Niemistö Date: Wed, 18 Jul 2018 10:26:07 +0000 (+0300) Subject: Use Runtime.halt instead of System.exit in delayed shutdown X-Git-Tag: v1.43.0~136^2~441^2 X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=commitdiff_plain;h=refs%2Fchanges%2F38%2F1938%2F1 Use Runtime.halt instead of System.exit in delayed shutdown Change-Id: I4c43ff1f73639948bcefa4bf3c41cf4a06ff6b95 --- diff --git a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/SimanticsWorkbenchApplication.java b/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/SimanticsWorkbenchApplication.java index aaacddc46..50e8aada7 100644 --- a/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/SimanticsWorkbenchApplication.java +++ b/bundles/org.simantics.workbench/src/org/simantics/workbench/internal/SimanticsWorkbenchApplication.java @@ -193,7 +193,9 @@ public class SimanticsWorkbenchApplication implements IApplication, IExecutableE try { Thread.sleep(delayMs); LOGGER.warn("Delayed shutdown forced the application to exit with code {}.", exitCode); - System.exit(exitCode); + // Method halt is used instead of System.exit, because running + // of shutdown hooks hangs the application in some cases. + Runtime.getRuntime().halt(exitCode); } catch (InterruptedException e) { e.printStackTrace(); }