mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Remove REMOVED query state to reduce complexity
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
package net.openhft.chronicle.hash.impl.stage.query;
|
||||
|
||||
import net.openhft.chronicle.hash.Data;
|
||||
import net.openhft.chronicle.hash.HashEntry;
|
||||
import net.openhft.chronicle.hash.impl.VanillaChronicleHashHolder;
|
||||
import net.openhft.chronicle.hash.impl.stage.entry.HashEntryStages;
|
||||
import net.openhft.chronicle.hash.impl.stage.entry.HashLookupPos;
|
||||
@@ -30,7 +29,7 @@ import net.openhft.sg.Stage;
|
||||
import net.openhft.sg.StageRef;
|
||||
import net.openhft.sg.Staged;
|
||||
|
||||
import static net.openhft.chronicle.hash.impl.stage.query.KeySearch.SearchState.DELETED;
|
||||
import static net.openhft.chronicle.hash.impl.stage.query.KeySearch.SearchState.ABSENT;
|
||||
import static net.openhft.chronicle.hash.impl.stage.query.KeySearch.SearchState.PRESENT;
|
||||
|
||||
@Staged
|
||||
@@ -137,7 +136,7 @@ public abstract class HashQuery<K> implements SetEntry<K> {
|
||||
s.innerWriteLock.lock();
|
||||
hashLookupSearch.remove();
|
||||
entry.innerRemoveEntryExceptHashLookupUpdate();
|
||||
ks.setSearchState(DELETED);
|
||||
ks.setSearchState(ABSENT);
|
||||
initPresenceOfEntry(EntryPresence.ABSENT);
|
||||
} else {
|
||||
throw new IllegalStateException("Entry is absent when doRemove() is called");
|
||||
|
||||
@@ -27,7 +27,7 @@ import net.openhft.sg.Stage;
|
||||
import net.openhft.sg.StageRef;
|
||||
import net.openhft.sg.Staged;
|
||||
|
||||
import static net.openhft.chronicle.hash.impl.stage.query.KeySearch.SearchState.DELETED;
|
||||
import static net.openhft.chronicle.hash.impl.stage.query.KeySearch.SearchState.ABSENT;
|
||||
import static net.openhft.chronicle.hash.impl.stage.query.KeySearch.SearchState.PRESENT;
|
||||
|
||||
@Staged
|
||||
@@ -48,7 +48,6 @@ public abstract class KeySearch<K> {
|
||||
|
||||
public enum SearchState {
|
||||
PRESENT,
|
||||
DELETED,
|
||||
ABSENT
|
||||
}
|
||||
|
||||
@@ -94,12 +93,7 @@ public abstract class KeySearch<K> {
|
||||
return searchState == PRESENT;
|
||||
}
|
||||
|
||||
public boolean searchStateDeleted() {
|
||||
return searchState == DELETED && !s.nestedContextsLockedOnSameSegment &&
|
||||
s.innerUpdateLock.isHeldByCurrentThread();
|
||||
}
|
||||
|
||||
public boolean searchStateAbsent() {
|
||||
return !searchStatePresent() && !searchStateDeleted();
|
||||
return searchState == ABSENT;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user