Fix ChronicleMap leak through Closeable in ChronicleMapBuilder.establishCleanupThread()

This commit is contained in:
leventov
2016-12-10 23:19:43 -06:00
parent d3a968bd31
commit 0ca612ee6d
@@ -1814,11 +1814,12 @@ public final class ChronicleMapBuilder<K, V> implements
// WARNING this relies on the fact that ReplicatedChronicleMap closes closeables in the same
// order as they are added, i. e. OldDeletedEntriesCleanupThread instance close()d before
// the following closeable
String mapIdentityString = map.toIdentityString();
map.addCloseable(() -> {
try {
cleanupThread.join();
} catch (InterruptedException e) {
LOG.warn(map.toIdentityString() +
LOG.warn(mapIdentityString +
": Interrupted while waiting for the cleanup thread to cease");
Thread.currentThread().interrupt();
}