提交 2d4496ca authored 作者: andrei's avatar andrei

stick missed field access into synchronized block

上级 7cde4bd0
......@@ -67,9 +67,13 @@ class OnExitDatabaseCloser extends Thread {
}
private static void onShutdown() {
terminated = true;
ArrayList<Database> databases;
synchronized(OnExitDatabaseCloser.class) {
terminated = true;
databases = new ArrayList<>(DATABASES.keySet());
}
RuntimeException root = null;
for (Database database : collectDatabasesToClose()) {
for (Database database : databases) {
try {
database.close(true);
} catch (RuntimeException e) {
......@@ -95,10 +99,6 @@ class OnExitDatabaseCloser extends Thread {
}
}
private static synchronized Iterable<Database> collectDatabasesToClose() {
return new ArrayList<>(DATABASES.keySet());
}
private OnExitDatabaseCloser() {
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论