提交 2ffb4adb authored 作者: Thomas Mueller's avatar Thomas Mueller

After the database was closed, a null pointer exception could occur in Database.flush.

上级 d9db36c7
......@@ -1149,10 +1149,12 @@ public class Database implements DataHandler {
private void closeFiles() {
try {
synchronized (this) {
if (pageStore != null) {
pageStore.close();
pageStore = null;
}
}
} catch (DbException e) {
traceSystem.getTrace(Trace.DATABASE).error("close", e);
}
......@@ -1674,10 +1676,10 @@ public class Database implements DataHandler {
* Flush all pending changes to the transaction log.
*/
public void flush() {
synchronized (this) {
if (readOnly || pageStore == null) {
return;
}
synchronized (this) {
pageStore.flushLog();
}
}
......@@ -1751,10 +1753,10 @@ public class Database implements DataHandler {
* executing the SQL statement CHECKPOINT SYNC.
*/
public void sync() {
synchronized (this) {
if (readOnly || pageStore == null) {
return;
}
synchronized (this) {
pageStore.sync();
}
}
......@@ -2125,10 +2127,12 @@ public class Database implements DataHandler {
*/
public void checkpoint() {
if (persistent) {
synchronized (this) {
if (pageStore != null) {
pageStore.checkpoint();
}
}
}
getTempFileDeleter().deleteUnused();
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论