mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
add on remove entry call back method and open free method extending by
subclass
This commit is contained in:
@@ -1496,6 +1496,7 @@ class ReplicatedChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
|
||||
if (!keyEquals(keyInterop, metaKeyInterop, key, keySize, entry))
|
||||
continue;
|
||||
// key is found
|
||||
onRemoveEntry(this, pos);
|
||||
entry.skip(keySize);
|
||||
long timestampPos = entry.position();
|
||||
long replacedTimestamp = entry.readLong(timestampPos);
|
||||
@@ -1572,6 +1573,7 @@ class ReplicatedChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
|
||||
|
||||
hashLookup.putAfterFailedSearch(searchState, pos);
|
||||
hashLookup.removePosition(pos);
|
||||
onRemoveEntry(this, pos);
|
||||
// listener.onRemove() might be missing here
|
||||
// depends on onRemove() semantics
|
||||
}
|
||||
@@ -1583,6 +1585,15 @@ class ReplicatedChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
|
||||
return resultUnused ? null : readValue.readNull();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* call when remove an entry in segment, regardless of local or remote remove, entry found or not found.<br>
|
||||
* caller has held the segment write lock
|
||||
* @param segment
|
||||
* @param pos
|
||||
*/
|
||||
void onRemoveEntry(Segment segment, long pos){
|
||||
}
|
||||
|
||||
<KB, KBI, MKBI extends MetaBytesInterop<KB, ? super KBI>,
|
||||
RV, VB extends RV, VBI, MVBI extends MetaBytesInterop<RV, ? super VBI>>
|
||||
|
||||
@@ -2618,7 +2618,7 @@ class VanillaChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
|
||||
}
|
||||
}
|
||||
|
||||
private void free(long fromPos, int chunks) {
|
||||
void free(long fromPos, int chunks) {
|
||||
freeList.clear(fromPos, fromPos + chunks);
|
||||
if (fromPos < nextPosToSearchFrom)
|
||||
nextPosToSearchFrom = fromPos;
|
||||
|
||||
Reference in New Issue
Block a user