提交 a9e71a03 authored 作者: Andrei Tokar's avatar Andrei Tokar

do not throw ecxeptions from FileStore.close() when it's already closed.

上级 f3801728
...@@ -186,11 +186,10 @@ public class FileStore { ...@@ -186,11 +186,10 @@ public class FileStore {
* Close this store. * Close this store.
*/ */
public void close() { public void close() {
if(file != null) { if(file != null && file.isOpen()) {
try { try {
if (fileLock != null) { if (fileLock != null && fileLock.isValid()) {
fileLock.release(); fileLock.release();
fileLock = null;
} }
file.close(); file.close();
freeSpace.clear(); freeSpace.clear();
...@@ -199,6 +198,7 @@ public class FileStore { ...@@ -199,6 +198,7 @@ public class FileStore {
DataUtils.ERROR_WRITING_FAILED, DataUtils.ERROR_WRITING_FAILED,
"Closing failed for file {0}", fileName, e); "Closing failed for file {0}", fileName, e);
} finally { } finally {
fileLock = null;
file = null; file = null;
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论