fix: game is blocked for launching
This commit is contained in:
@@ -106,7 +106,6 @@ public final class Launcher extends Application {
|
|||||||
Schedulers.shutdown();
|
Schedulers.shutdown();
|
||||||
Controllers.shutdown();
|
Controllers.shutdown();
|
||||||
Platform.exit();
|
Platform.exit();
|
||||||
Lang.executeDelayed(OperatingSystem::forceGC, TimeUnit.SECONDS, 5, true);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,11 +73,15 @@ public final class Schedulers {
|
|||||||
public static synchronized void shutdown() {
|
public static synchronized void shutdown() {
|
||||||
Logging.LOG.info("Shutting down executor services.");
|
Logging.LOG.info("Shutting down executor services.");
|
||||||
|
|
||||||
|
// shutdownNow will interrupt all threads.
|
||||||
|
// So when we want to close the app, no threads need to be waited for finish.
|
||||||
|
// Sometimes it resolves the problem that the app does not exit.
|
||||||
|
|
||||||
if (CACHED_EXECUTOR != null)
|
if (CACHED_EXECUTOR != null)
|
||||||
CACHED_EXECUTOR.shutdown();
|
CACHED_EXECUTOR.shutdownNow();
|
||||||
|
|
||||||
if (IO_EXECUTOR != null)
|
if (IO_EXECUTOR != null)
|
||||||
IO_EXECUTOR.shutdown();
|
IO_EXECUTOR.shutdownNow();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Future<?> schedule(Executor executor, Runnable command) {
|
public static Future<?> schedule(Executor executor, Runnable command) {
|
||||||
|
|||||||
Reference in New Issue
Block a user