ENT-2569: Clean-up content of registeredShutdowns. (#4048)

Please see comment for more info.
This commit is contained in:
Viktor Kolomeyko 2018-10-10 17:52:00 +01:00 committed by GitHub
parent b8b2cc772d
commit 0e68f26c0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,7 +48,12 @@ class ShutdownManager(private val executorService: ExecutorService) {
emptyList<CordaFuture<() -> Unit>>()
} else {
isShutdown = true
registeredShutdowns
val result = ArrayList(registeredShutdowns)
// It is important to clear `registeredShutdowns` that has been actioned upon as more than 1 driver can be created per test.
// Given that `ShutdownManager` is reachable from `ApplicationShutdownHooks`, everything that was scheduled for shutdown
// during 1st driver launch will not be eligible for GC during second driver launch therefore retained in memory.
registeredShutdowns.clear()
result
}
}