mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-16 15:26:27 -04:00
Logs stopApplication stack trace
This commit is contained in:
parent
c60ae111ef
commit
a03e3fea12
@ -82,25 +82,28 @@ public final class Launcher extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void stopApplication() {
|
public static void stopApplication() {
|
||||||
JFXUtilities.runInFX(() -> {
|
Logging.LOG.info("Stopping application.\n" + StringUtils.getStackTrace(Thread.currentThread().getStackTrace()));
|
||||||
stopWithoutPlatform();
|
|
||||||
Platform.exit();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void stopWithoutPlatform() {
|
|
||||||
Logging.LOG.info("Stopping application without JavaFX Toolkit");
|
|
||||||
|
|
||||||
JFXUtilities.runInFX(() -> {
|
JFXUtilities.runInFX(() -> {
|
||||||
if (Controllers.getStage() == null)
|
if (Controllers.getStage() == null)
|
||||||
return;
|
return;
|
||||||
Controllers.getStage().close();
|
Controllers.getStage().close();
|
||||||
|
|
||||||
Logging.LOG.info("Shutting down executor services.");
|
|
||||||
Schedulers.shutdown();
|
Schedulers.shutdown();
|
||||||
|
|
||||||
Controllers.shutdown();
|
Controllers.shutdown();
|
||||||
|
Platform.exit();
|
||||||
|
Lang.executeDelayed(OperatingSystem::forceGC, TimeUnit.SECONDS, 5, true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void stopWithoutPlatform() {
|
||||||
|
Logging.LOG.info("Stopping application without JavaFX Toolkit.\n" + StringUtils.getStackTrace(Thread.currentThread().getStackTrace()));
|
||||||
|
|
||||||
|
JFXUtilities.runInFX(() -> {
|
||||||
|
if (Controllers.getStage() == null)
|
||||||
|
return;
|
||||||
|
Controllers.getStage().close();
|
||||||
|
Schedulers.shutdown();
|
||||||
|
Controllers.shutdown();
|
||||||
Lang.executeDelayed(OperatingSystem::forceGC, TimeUnit.SECONDS, 5, true);
|
Lang.executeDelayed(OperatingSystem::forceGC, TimeUnit.SECONDS, 5, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
package org.jackhuang.hmcl.task;
|
package org.jackhuang.hmcl.task;
|
||||||
|
|
||||||
import org.jackhuang.hmcl.util.Constants;
|
import org.jackhuang.hmcl.util.Constants;
|
||||||
|
import org.jackhuang.hmcl.util.Logging;
|
||||||
|
|
||||||
import java.util.concurrent.*;
|
import java.util.concurrent.*;
|
||||||
|
|
||||||
@ -115,6 +116,8 @@ public final class Schedulers {
|
|||||||
static final Scheduler NONE = new SchedulerImpl(Constants.emptyConsumer());
|
static final Scheduler NONE = new SchedulerImpl(Constants.emptyConsumer());
|
||||||
|
|
||||||
public static synchronized void shutdown() {
|
public static synchronized void shutdown() {
|
||||||
|
Logging.LOG.info("Shutting down executor services.");
|
||||||
|
|
||||||
if (CACHED_EXECUTOR != null)
|
if (CACHED_EXECUTOR != null)
|
||||||
CACHED_EXECUTOR.shutdown();
|
CACHED_EXECUTOR.shutdown();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user