Improvements to ChronicleMap resource closing subsystem, making it more robust in exotic scenarios (OutOfMemoryError, StackOverflowError) and be able to close after incorrect attempt to close when a context is open in the same thread

This commit is contained in:
leventov
2016-12-26 14:27:32 +08:00
parent 4bb2decc34
commit fa70e216bd
10 changed files with 314 additions and 145 deletions
@@ -657,6 +657,8 @@ public abstract class VanillaChronicleHash<K,
@Override
public final void close() {
if (resources.releaseManually()) {
// Don't try to execute cleaner.clean() and ChronicleHashCloseOnExitHook.remove() from
// finally section of try block wrapping resources.releaseManually(), because
// Releases nothing after resources.releaseManually(), only removes the cleaner
// from the internal linked list of all cleaners.
cleaner.clean();