mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Should acquire updateLock, not readLock, before iterating each segment
This commit is contained in:
@@ -730,10 +730,10 @@ public class ReplicatedChronicleMap<K, V, R> extends VanillaChronicleMap<K, V, R
|
||||
// raise and bit reading:
|
||||
// bit raised ->
|
||||
// lock released (end of update operation) ->
|
||||
// lock acquired (the following acquireAndReleaseReadLock() call) ->
|
||||
// lock acquired (the following acquireAndReleaseUpdateLock() call) ->
|
||||
// bits are iterated (raised bits should be visible here)
|
||||
if (entryPos == -1) {
|
||||
acquireAndReleaseReadLock(segmentIndex);
|
||||
acquireAndReleaseUpdateLock(segmentIndex);
|
||||
}
|
||||
|
||||
if ((nextEntryPos = tierModIterFrame.nextSetBit(nativeAccess(),
|
||||
@@ -783,11 +783,11 @@ public class ReplicatedChronicleMap<K, V, R> extends VanillaChronicleMap<K, V, R
|
||||
return NOT_FOUND;
|
||||
}
|
||||
|
||||
private void acquireAndReleaseReadLock(int segmentIndex) {
|
||||
private void acquireAndReleaseUpdateLock(int segmentIndex) {
|
||||
try (CompiledReplicatedMapIterationContext<K, V, R> c =
|
||||
iterationContext()) {
|
||||
c.initSegmentIndex(segmentIndex);
|
||||
c.readLock().lock();
|
||||
c.updateLock().lock();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user