Close wrapped value after each iteration in MapSegmentIteration

This commit is contained in:
leventov
2016-12-10 21:03:20 -06:00
parent e0b534af23
commit fafc50f89d
2 changed files with 11 additions and 16 deletions
@@ -137,6 +137,7 @@ public abstract class HashSegmentIteration<K, E extends HashEntry<K>>
break;
}
} finally {
hookAfterEachIteration();
// if doReplaceValue() -> relocation() -> alloc() -> nextTier()
// was called, restore the tier we were iterating over
if (s.tier != currentTier) {
@@ -170,6 +171,9 @@ public abstract class HashSegmentIteration<K, E extends HashEntry<K>>
return interrupted;
}
public void hookAfterEachIteration() {
}
@Override
public void forEachSegmentEntry(Consumer<? super E> action) {
forEachSegmentEntryWhile(e -> {