inUse check now uses the endpoint for extra checks
This commit is contained in:
parent
28d170c25c
commit
db385d0c1a
|
@ -164,7 +164,7 @@ class AeronDriver private constructor(config: Configuration, val logger: KLogger
|
|||
|
||||
driverConfigurations.forEach { entry ->
|
||||
val driver = entry.value
|
||||
val closed = if (traceEnabled) driver.isInUse(logger) else driver.isRunning()
|
||||
val closed = if (traceEnabled) driver.isInUse(null, logger) else driver.isRunning()
|
||||
|
||||
if (closed) {
|
||||
logger.error { "Aeron Driver [${driver.driverId}]: still running during check (${driver.aeronDirectory})" }
|
||||
|
@ -176,7 +176,7 @@ class AeronDriver private constructor(config: Configuration, val logger: KLogger
|
|||
// this is already checked if we are in trace mode.
|
||||
driverConfigurations.forEach { entry ->
|
||||
val driver = entry.value
|
||||
if (driver.isInUse(logger)) {
|
||||
if (driver.isInUse(null, logger)) {
|
||||
logger.error { "Aeron Driver [${driver.driverId}]: still in use during check (${driver.aeronDirectory})" }
|
||||
return@withLock false
|
||||
}
|
||||
|
|
|
@ -710,14 +710,13 @@ internal class AeronDriverInternal(endPoint: EndPoint<*>?, private val config: C
|
|||
return context.isRunning()
|
||||
}
|
||||
|
||||
suspend fun isInUse(logger: KLogger): Boolean {
|
||||
suspend fun isInUse(endPoint: EndPoint<*>?, logger: KLogger): Boolean {
|
||||
// as many "sort-cuts" as we can for checking if the current Aeron Driver/client is still in use
|
||||
if (!isRunning()) {
|
||||
logger.trace { "Aeron Driver [$driverId]: not running" }
|
||||
return false
|
||||
}
|
||||
|
||||
val driverId = config.id
|
||||
if (registeredPublications.value > 0) {
|
||||
if (logger.isTraceEnabled) {
|
||||
val elements = registeredPublicationsTrace.elements
|
||||
|
@ -740,7 +739,7 @@ internal class AeronDriverInternal(endPoint: EndPoint<*>?, private val config: C
|
|||
return true
|
||||
}
|
||||
|
||||
if (endPointUsages.isNotEmpty()) {
|
||||
if (endPointUsages.size > 1 && !endPointUsages.contains(endPoint)) {
|
||||
logger.debug { "Aeron Driver [$driverId]: still referenced by ${endPointUsages.size} endpoints" }
|
||||
return true
|
||||
}
|
||||
|
@ -799,6 +798,7 @@ internal class AeronDriverInternal(endPoint: EndPoint<*>?, private val config: C
|
|||
if (isInUse(logger)) {
|
||||
logger.debug { "Aeron Driver [$driverId]: in use, not shutting down this instance." }
|
||||
return@withLock false
|
||||
if (isInUse(endPoint, logger)) {
|
||||
}
|
||||
|
||||
val removed = AeronDriver.driverConfigurations[driverId]
|
||||
|
|
Loading…
Reference in New Issue