Signed-off-by: Graham <gpe@openrs2.org>
@ -17,7 +17,13 @@ public class GameServer @Inject constructor(
serviceManager.startAsync()
runtime.addShutdownHook(shutdownHook)
serviceManager.awaitHealthy()
try {
} catch (ex: Throwable) {
serviceManager.stopAsync().awaitStopped()
runtime.removeShutdownHook(shutdownHook)
throw ex
}
val elapsed = System.nanoTime() - start
logger.info { "Started OpenRS2 in ${elapsed / NANOS_PER_MILLI} milliseconds" }
@ -36,6 +36,7 @@ public class NetworkService @Inject constructor(
CompletableFuture.allOf(httpFuture, rs2PrimaryFuture, rs2SecondaryFuture).handle { _, ex ->
if (ex != null) {
group.shutdownGracefully()
notifyFailed(ex)
} else {
notifyStarted()