mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[io] move synchronized markCorrupted out of storage lock to avoid incorrect locking order
This commit is contained in:
@@ -454,12 +454,19 @@ public abstract class PersistentEnumeratorBase<Data> implements Forceable, Close
|
||||
}
|
||||
|
||||
public Data valueOf(int idx) throws IOException {
|
||||
lockStorage();
|
||||
try {
|
||||
int addr = indexToAddr(idx);
|
||||
|
||||
if (myKeyStorage == null) return ((InlineKeyDescriptor<Data>)myDataDescriptor).fromInt(addr);
|
||||
return myKeyStorage.read(addr, myDataDescriptor);
|
||||
lockStorage();
|
||||
try {
|
||||
int addr = indexToAddr(idx);
|
||||
|
||||
if (myKeyStorage == null) return ((InlineKeyDescriptor<Data>)myDataDescriptor).fromInt(addr);
|
||||
return myKeyStorage.read(addr, myDataDescriptor);
|
||||
}
|
||||
finally {
|
||||
unlockStorage();
|
||||
}
|
||||
|
||||
}
|
||||
catch (IOException io) {
|
||||
markCorrupted();
|
||||
@@ -469,9 +476,6 @@ public abstract class PersistentEnumeratorBase<Data> implements Forceable, Close
|
||||
markCorrupted();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
finally {
|
||||
unlockStorage();
|
||||
}
|
||||
}
|
||||
|
||||
int reenumerate(Data key) throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user