diff --git a/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java b/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java index 8304cdae7..8870b2ced 100755 --- a/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java +++ b/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java @@ -2569,8 +2569,7 @@ class VanillaChronicleMap, throw new NoSuchElementException(); final Segment segment = segments[segIndex]; ThreadLocalCopies copies = SegmentState.getCopies(null); - SegmentState segmentState = SegmentState.get(copies); - try { + try (SegmentState segmentState = SegmentState.get(copies)) { try { segment.readLock(null); } catch (InterruptedException e) { @@ -2584,7 +2583,6 @@ class VanillaChronicleMap, advance(returnedSeg = segIndex, returnedPos = pos); return returnedEntry = segment.getEntry(segmentState, pos); } finally { - segmentState.close(); segment.readUnlock(); } }