try harder to close files ignoring exceptions

This commit is contained in:
Maxim.Mossienko
2015-11-16 19:56:40 +01:00
parent aebc3568fb
commit 424f809931
2 changed files with 12 additions and 9 deletions
@@ -202,7 +202,7 @@ public class MapReduceIndex<Key, Value, Input> implements UpdatableIndex<Key,Val
try {
index.close();
}
catch (IOException ignored) {
catch (Throwable ignored) {
}
IOUtil.deleteAllFilesStartingWith(baseFile);
@@ -505,16 +505,19 @@ public class PersistentHashMapValueStorage {
}
public void dispose() {
if (myCompressedAppendableFile != null) myCompressedAppendableFile.dispose();
if (mySize < 0) assert false; // volatile read
ourReadersCache.remove(myPath);
ourAppendersCache.remove(myPath);
try {
if (myCompressedAppendableFile != null) myCompressedAppendableFile.dispose();
} finally {
if (mySize < 0) assert false; // volatile read
ourReadersCache.remove(myPath);
ourAppendersCache.remove(myPath);
ourRandomAccessFileCache.remove(myPath);
ourRandomAccessFileCache.remove(myPath);
if (myCompactionModeReader != null) {
myCompactionModeReader.dispose();
myCompactionModeReader = null;
if (myCompactionModeReader != null) {
myCompactionModeReader.dispose();
myCompactionModeReader = null;
}
}
}