Lock the segment on the write level right away in HashQuery.doRemove()

This commit is contained in:
leventov
2016-02-28 21:32:11 +07:00
parent e37de00202
commit dc4b578bef
@@ -129,15 +129,12 @@ public abstract class HashQuery<K> implements SetEntry<K> {
@Override
public void doRemove() {
checkOnEachPublicOperation.checkOnEachPublicOperation();
s.innerUpdateLock.lock();
s.innerWriteLock.lock();
if (ks.searchStatePresent()) {
entry.innerRemoveEntryExceptHashLookupUpdate();
hashLookupSearch.remove();
ks.setSearchState(ABSENT);
initPresenceOfEntry(EntryPresence.ABSENT);
// write lock scope is reduced as much as possible
s.innerWriteLock.lock();
hashLookupSearch.remove();
} else {
throw new IllegalStateException("Entry is absent when doRemove() is called");
}