Commit ca628d2f authored by NicolaiO's avatar NicolaiO 🐼 Committed by TIGERs GitLab
Browse files

Resolve "Add a shutdown hook that stops the GC if it was not stopped yet"

Closes #1564

See merge request main/Sumatra!1451

sumatra-commit: 13a92640721d73ff8c2df5eaf36e6c178406a478
parent f6c533ae
Pipeline #17097 passed with stage
in 4 minutes and 16 seconds
...@@ -35,6 +35,7 @@ public class SslGameControllerProcess implements Runnable ...@@ -35,6 +35,7 @@ public class SslGameControllerProcess implements Runnable
private final int gcUiPort; private final int gcUiPort;
private final String publishAddress; private final String publishAddress;
private final String timeAcquisitionMode; private final String timeAcquisitionMode;
private final Thread shutdownHook = new Thread(this::stop);
private Process process = null; private Process process = null;
...@@ -57,6 +58,8 @@ public class SslGameControllerProcess implements Runnable ...@@ -57,6 +58,8 @@ public class SslGameControllerProcess implements Runnable
return; return;
} }
Runtime.getRuntime().addShutdownHook(shutdownHook);
Path engineConfig = Path.of("config", "engine.yaml"); Path engineConfig = Path.of("config", "engine.yaml");
Path engineConfigDefault = Path.of("config", "engine-default.yaml"); Path engineConfigDefault = Path.of("config", "engine-default.yaml");
...@@ -111,6 +114,7 @@ public class SslGameControllerProcess implements Runnable ...@@ -111,6 +114,7 @@ public class SslGameControllerProcess implements Runnable
log.warn("game-controller has returned a non-zero exit code: {}", p.exitValue()); log.warn("game-controller has returned a non-zero exit code: {}", p.exitValue());
} }
log.debug("game-controller process thread finished"); log.debug("game-controller process thread finished");
Runtime.getRuntime().removeShutdownHook(shutdownHook);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment