diff --git a/src/main/java/net/openhft/chronicle/map/AbstractChronicleMap.java b/src/main/java/net/openhft/chronicle/map/AbstractChronicleMap.java index eb38d48db..87c68c5da 100644 --- a/src/main/java/net/openhft/chronicle/map/AbstractChronicleMap.java +++ b/src/main/java/net/openhft/chronicle/map/AbstractChronicleMap.java @@ -295,6 +295,7 @@ abstract class AbstractChronicleMap extends AbstractMap c.updateLock().lock(); c.initSegment(); c.hashLookup.forEach(this); + return; } finally { context = null; } @@ -466,7 +467,8 @@ abstract class AbstractChronicleMap extends AbstractMap try { if (!c.containsKey()) // for replicated map return false; - shouldBreak = predicate.test(c); + shouldBreak = !predicate.test(c); + c.closeKey0(); // release all exclusive locks: possibly if context.remove() is performed // in the callback, or acquired manually while (c.writeLockCount > 0) {