mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IJPL-189248: fix deadlock
- PersistentMapImpl.doContainsMapping() violated the constraint (stated in PersistentEnumeratorBase.myLock) that PersistentMapImpl.myLock must always be acquired _before_ storage lock GitOrigin-RevId: cc54be52d3043ce38c22c58b9688683906e4d567
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3c60929c6f
commit
d9f09c472b
@@ -253,11 +253,11 @@ public final class PersistentMapImpl<Key, Value> implements PersistentMapBase<Ke
|
||||
return myValueExternalizer;
|
||||
}
|
||||
|
||||
public @NotNull KeyDescriptor<Key> getKeyDescriptor(){
|
||||
public @NotNull KeyDescriptor<Key> getKeyDescriptor() {
|
||||
return myKeyDescriptor;
|
||||
}
|
||||
|
||||
public @NotNull PersistentMapBuilder<Key, Value> builder(){
|
||||
public @NotNull PersistentMapBuilder<Key, Value> builder() {
|
||||
//builder is mutable, so return a copy of it:
|
||||
return myBuilder.copy();
|
||||
}
|
||||
@@ -720,22 +720,22 @@ public final class PersistentMapImpl<Key, Value> implements PersistentMapBase<Ke
|
||||
private boolean doContainsMapping(Key key) throws IOException {
|
||||
flushAppendCache(key);
|
||||
|
||||
myEnumerator.lockStorageRead();
|
||||
try {
|
||||
if (myDirectlyStoreLongFileOffsetMode) {
|
||||
return ((PersistentBTreeEnumerator<Key>)myEnumerator).getNonNegativeValue(key) != NULL_ADDR;
|
||||
}
|
||||
else {
|
||||
final int id = myEnumerator.tryEnumerate(key);
|
||||
if (myDirectlyStoreLongFileOffsetMode) {
|
||||
return ((PersistentBTreeEnumerator<Key>)myEnumerator).getNonNegativeValue(key) != NULL_ADDR;
|
||||
}
|
||||
else {
|
||||
myEnumerator.lockStorageRead();
|
||||
try {
|
||||
int id = myEnumerator.tryEnumerate(key);
|
||||
if (id == DataEnumerator.NULL_ID) {
|
||||
return false;
|
||||
}
|
||||
if (myIntMapping) return true;
|
||||
return readValueId(id) != NULL_ADDR;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
myEnumerator.unlockStorageRead();
|
||||
finally {
|
||||
myEnumerator.unlockStorageRead();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user