create MapClosable which replaces the default isClosed() method that was removed from chronicle closable

This commit is contained in:
Rob Austin
2020-05-29 16:40:58 +01:00
parent 1a2468b6d4
commit f042add96b
6 changed files with 57 additions and 80 deletions
@@ -16,7 +16,7 @@
package net.openhft.chronicle.map;
import net.openhft.chronicle.core.io.Closeable;
import net.openhft.chronicle.core.io.DefaultCloseable;
import net.openhft.chronicle.hash.ChronicleHashBuilderPrivateAPI;
import net.openhft.chronicle.hash.ReplicatedHashSegmentContext;
import net.openhft.chronicle.hash.replication.ReplicableEntry;
@@ -34,14 +34,13 @@ import static net.openhft.chronicle.hash.replication.TimeProvider.currentTime;
import static net.openhft.chronicle.hash.replication.TimeProvider.systemTimeIntervalBetween;
class OldDeletedEntriesCleanupThread extends Thread
implements Closeable, Predicate<ReplicableEntry> {
implements DefaultCloseable, Predicate<ReplicableEntry> {
private static final Logger LOG = LoggerFactory.getLogger(OldDeletedEntriesCleanupThread.class);
/**
* Don't store a strong ref to a map in order to avoid it's leaking, if the user forgets to
* close() map, from where this thread is shut down explicitly. Dereference map within
* a single method, {@link #cleanupSegment()}. The map has a chance to be collected by GC when
* this thread is sleeping after cleaning up a segment.
* Don't store a strong ref to a map in order to avoid it's leaking, if the user forgets to close() map, from where this thread is shut down
* explicitly. Dereference map within a single method, {@link #cleanupSegment()}. The map has a chance to be collected by GC when this thread is
* sleeping after cleaning up a segment.
*/
private final WeakReference<ReplicatedChronicleMap<?, ?, ?>> mapRef;
/**