Safer closing of the aeron client during close process
This commit is contained in:
parent
9bac797541
commit
8605040819
|
@ -648,12 +648,14 @@ internal constructor(val type: Class<*>, internal val config: Configuration) : A
|
||||||
if (shutdown.compareAndSet(expect = false, update = true)) {
|
if (shutdown.compareAndSet(expect = false, update = true)) {
|
||||||
logger.info { "Shutting down..." }
|
logger.info { "Shutting down..." }
|
||||||
|
|
||||||
|
try {
|
||||||
aeron.close()
|
aeron.close()
|
||||||
(aeron.context().threadFactory() as NamedThreadFactory).group.destroy()
|
} catch (e: Exception) {
|
||||||
|
logger.error("Error stopping aeron.", e)
|
||||||
|
}
|
||||||
|
|
||||||
runBlocking {
|
runBlocking {
|
||||||
AeronConfig.stopDriver(mediaDriver, logger)
|
AeronConfig.stopDriver(mediaDriver, logger)
|
||||||
|
|
||||||
connections.forEach {
|
connections.forEach {
|
||||||
it.close()
|
it.close()
|
||||||
}
|
}
|
||||||
|
@ -668,6 +670,8 @@ internal constructor(val type: Class<*>, internal val config: Configuration) : A
|
||||||
|
|
||||||
close0()
|
close0()
|
||||||
|
|
||||||
|
(aeron.context().threadFactory() as NamedThreadFactory).group.destroy()
|
||||||
|
|
||||||
// if we are waiting for shutdown, cancel the waiting thread (since we have shutdown now)
|
// if we are waiting for shutdown, cancel the waiting thread (since we have shutdown now)
|
||||||
shutdownWaiter.cancel()
|
shutdownWaiter.cancel()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user