Remove REMOVED query state to reduce complexity

This commit is contained in:
leventov
2016-02-16 20:40:47 +07:00
parent c3e436d390
commit 7293e5d7bb
6 changed files with 13 additions and 121 deletions
@@ -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;
}
}