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?a=commitdiff_plain;h=4dda3eb992472f5ea3903725f7497a0728c66140;p=simantics%2Fplatform.git 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(); }