mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Make searchStatePresent() call in HashLookupSearch.putNewVolatile() independent on assertions enabled. Similar to HashLookupPos.initHashLookupPos() and segmentTier() initialization. Possible fix for #60
This commit is contained in:
@@ -32,9 +32,12 @@ public abstract class HashLookupPos {
|
||||
public abstract boolean hashLookupPosInit();
|
||||
|
||||
public void initHashLookupPos() {
|
||||
// validation + make hashLookupPos a dependant of tier. This is needed, because after
|
||||
// tier change should re-perform hashLookupSearch, starting from the searchStartPos
|
||||
assert s.tier >= 0;
|
||||
// Validation + make hashLookupPos a dependant of tier. This is needed, because after
|
||||
// tier change should re-perform hashLookupSearch, starting from the searchStartPos.
|
||||
// Not an assert statement, because segmentTier stage should be initialized regardless
|
||||
// assertions enabled or not.
|
||||
if (s.tier < 0)
|
||||
throw new AssertionError();
|
||||
s.innerReadLock.lock();
|
||||
this.hashLookupPos = hls.searchStartPos;
|
||||
}
|
||||
|
||||
@@ -79,9 +79,12 @@ public abstract class HashLookupSearch {
|
||||
}
|
||||
|
||||
public void putNewVolatile(long value) {
|
||||
// correctness check + make putNewVolatile() dependant on keySearch, this, in turn,
|
||||
// is needed for hlp.hashLookupPos re-initialization after nextTier()
|
||||
assert !ks.searchStatePresent();
|
||||
// Correctness check + make putNewVolatile() dependant on keySearch, this, in turn,
|
||||
// is needed for hlp.hashLookupPos re-initialization after nextTier().
|
||||
// Not an assert statement, because ks.searchStatePresent() should run regardless assertions
|
||||
// enabled or not.
|
||||
if (ks.searchStatePresent())
|
||||
throw new AssertionError();
|
||||
|
||||
hl().checkValueForPut(value);
|
||||
long currentEntry = hl().readEntry(addr(), hlp.hashLookupPos);
|
||||
|
||||
Reference in New Issue
Block a user