diff --git a/src/dorkbox/network/connection/EndPoint.kt b/src/dorkbox/network/connection/EndPoint.kt index cb969032..c27532d3 100644 --- a/src/dorkbox/network/connection/EndPoint.kt +++ b/src/dorkbox/network/connection/EndPoint.kt @@ -292,7 +292,7 @@ internal constructor(val type: Class<*>, internal val config: Configuration) : A val aeronDirectory = config.aeronLogDirectory!!.absolutePath if (!isRunning()) { - logger.debug { "Starting Aeron Media driver..."} + logger.debug("Starting Aeron Media driver...") mediaDriverContext .dirDeleteOnStart(true) @@ -719,17 +719,19 @@ internal constructor(val type: Class<*>, internal val config: Configuration) : A aeron?.close() mediaDriver?.close() - // the storage is closed via this as well - settingsStore.close() - - rmiGlobalSupport.close() - runBlocking { connections.forEach { it.close() } } + + // the storage is closed via this as well. + settingsStore.close() + // Connections are closed first, because we want to make sure that no RMI messages can be received + // when we close the RMI support objects (in which case, weird - but harmless - errors show up) + rmiGlobalSupport.close() + close0() // if we are waiting for shutdown, cancel the waiting thread (since we have shutdown now)