[io] move synchronized markCorrupted out of storage lock to avoid incorrect locking order

This commit is contained in:
Julia Beliaeva
2016-05-19 22:30:56 +03:00
parent bcddbd7049
commit cf91ada5c0
@@ -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 {