diff --git a/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java b/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java index 1db7c4f33..54b081101 100755 --- a/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java +++ b/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java @@ -3133,9 +3133,9 @@ class VanillaChronicleMap, throw new NoSuchElementException(); final Segment segment = segments[segIndex]; ThreadLocalCopies copies = SegmentState.getCopies(null); - try (SegmentState segmentState = SegmentState.get(copies)) { - segment.readLock(null); + segment.readLock(null); + try (SegmentState segmentState = SegmentState.get(copies)) { if (segment.hashLookup().getPositions().isClear(pos)) { // the pos was removed after the previous advance advance(segIndex, pos);