mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Add method CompactOffHeapLinearHashTable.readEntryVolatile() method and use it during key search
This commit is contained in:
@@ -133,8 +133,17 @@ public abstract class CompactOffHeapLinearHashTable {
|
||||
|
||||
public abstract long stepBack(long pos);
|
||||
|
||||
/**
|
||||
* Used when we assume we are holding at least update lock, and during recovery (because we
|
||||
* don't care about concurrency during recovery)
|
||||
*/
|
||||
public abstract long readEntry(long addr, long pos);
|
||||
|
||||
/**
|
||||
* Used when we are under read lock and aware of possible concurrent insertions
|
||||
*/
|
||||
public abstract long readEntryVolatile(long addr, long pos);
|
||||
|
||||
public abstract void writeEntryVolatile(long addr, long pos, long key, long value);
|
||||
|
||||
public abstract void writeEntry(long addr, long pos, long newEntry);
|
||||
@@ -148,6 +157,7 @@ public abstract class CompactOffHeapLinearHashTable {
|
||||
long posToShift = posToRemove;
|
||||
while (true) {
|
||||
posToShift = step(posToShift);
|
||||
// volatile read not needed because removed is performed under exclusive lock
|
||||
long entryToShift = readEntry(addr, posToShift);
|
||||
if (empty(entryToShift))
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user