]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Use Runtime.halt instead of System.exit in delayed shutdown 38/1938/1
authorHannu Niemistö <hannu.niemisto@semantum.fi>
Wed, 18 Jul 2018 10:26:07 +0000 (13:26 +0300)
committerHannu Niemistö <hannu.niemisto@semantum.fi>
Thu, 19 Jul 2018 08:48:37 +0000 (11:48 +0300)
Change-Id: I4c43ff1f73639948bcefa4bf3c41cf4a06ff6b95

bundles/org.simantics.workbench/src/org/simantics/workbench/internal/SimanticsWorkbenchApplication.java

index aaacddc460addfea176ea7f9ef45794cb7e7ee8e..50e8aada7b3f4cd3c14acdeee796427123db7dab 100644 (file)
@@ -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);
                 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();
                 }
                 } catch (InterruptedException e) {
                     e.printStackTrace();
                 }