Fix crashes not shutting down engine

This commit is contained in:
JeremyStar™ 2024-09-21 17:09:42 +02:00
parent a9cfc8c810
commit ebbc1778ae
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
2 changed files with 5 additions and 7 deletions

View file

@ -454,11 +454,8 @@ public final class Engine extends SubsystemClass {
* @since v1-alpha0 * @since v1-alpha0
*/ */
public synchronized void shutdown(@Range(from = 0, to = 255) int exitCode) { public synchronized void shutdown(@Range(from = 0, to = 255) int exitCode) {
switch (state) { if (state == EngineState.UNKNOWN || state == EngineState.SHUTDOWN)
case UNKNOWN, SHUTDOWN, CRASHED -> { return;
return;
}
}
logger.info("Shutting engine down"); logger.info("Shutting engine down");
if (state != EngineState.CRASHED) if (state != EngineState.CRASHED)

View file

@ -171,9 +171,10 @@ Dear developer: FIX YOUR GODDAMN SHIT! Please check if your code or 3rd party su
// Shutdown engine/JVM // Shutdown engine/JVM
if (!throwableHandled) if (!throwableHandled)
if (EngineConfiguration.getInstance().isLoggerImmediateShutdown()) if (EngineConfiguration.getInstance().isLoggerImmediateShutdown()) {
System.out.println("Halting JVM");
Runtime.getRuntime().halt(69); Runtime.getRuntime().halt(69);
else } else
Engine.getInstance().shutdown(69); Engine.getInstance().shutdown(69);
} }