Potential fix for race conditions when closing the endpoint wrt RMI support

This commit is contained in:
nathan 2020-09-03 22:23:17 +02:00
parent ca32ef36e1
commit 1273c8f386

View File

@ -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)