prevent JVM from exiting - because in FJP pool "all worker threads are initialized... master
authorVladimir Krivosheev <vladimir.krivosheev@jetbrains.com>
Mon, 12 Apr 2021 12:31:23 +0000 (14:31 +0200)
committerintellij-monorepo-bot <intellij-monorepo-bot-no-reply@jetbrains.com>
Mon, 12 Apr 2021 12:45:18 +0000 (12:45 +0000)
cannot change `AppStarter.start` method signature for now to return CompletableFuture

GitOrigin-RevId: c9aaae33c76ba5df48bdf120e13f02cab9d38cf8

platform/platform-impl/src/com/intellij/idea/StartupUtil.java

index ff5a83f4641faf513615cebf5e71ab80812aeb79..d346f89872c074ba8ee37f3c926ff888381b96c1 100644 (file)
@@ -256,6 +256,10 @@ public final class StartupUtil {
       importConfig(Arrays.asList(args), log, appStarterFuture, agreementDialogWasShown);
     }
     getAppStarter(appStarterFuture).start(Arrays.asList(args), prepareUiFuture);
       importConfig(Arrays.asList(args), log, appStarterFuture, agreementDialogWasShown);
     }
     getAppStarter(appStarterFuture).start(Arrays.asList(args), prepareUiFuture);
+
+    // prevent JVM from exiting - because in FJP pool "all worker threads are initialized with {@link Thread#isDaemon} set {@code true}"
+    // cannot change `AppStarter.start` method signature for now to return CompletableFuture
+    ForkJoinPool.commonPool().awaitQuiescence(Long.MAX_VALUE, TimeUnit.NANOSECONDS);
   }
 
   /** Called via reflection from {@link com.intellij.ide.WindowsCommandLineProcessor#processWindowsLauncherCommandLine}. */
   }
 
   /** Called via reflection from {@link com.intellij.ide.WindowsCommandLineProcessor#processWindowsLauncherCommandLine}. */