From 7e1886d82ce3e9b5c6dfeb2477adb9db4115a981 Mon Sep 17 00:00:00 2001 From: Peter Lawrey Date: Thu, 11 Jun 2015 16:02:07 +0100 Subject: [PATCH] Code tidy for Core --- .../java/net/openhft/chronicle/map/VanillaChronicleMap.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java b/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java index b3062b4a2..7ce54794a 100755 --- a/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java +++ b/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java @@ -2568,8 +2568,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) { @@ -2583,7 +2582,6 @@ class VanillaChronicleMap, advance(returnedSeg = segIndex, returnedPos = pos); return returnedEntry = segment.getEntry(segmentState, pos); } finally { - segmentState.close(); segment.readUnlock(); } }