提交 7cde4bd0 authored 作者: andrei's avatar andrei

fix deadlock between OnExitDatabaseCloser.DATABASES and Engine.DATABASES

上级 9ce14802
......@@ -5,6 +5,7 @@
*/
package org.h2.engine;
import java.util.ArrayList;
import java.util.WeakHashMap;
import org.h2.message.Trace;
......@@ -65,10 +66,10 @@ class OnExitDatabaseCloser extends Thread {
}
}
private static synchronized void onShutdown() {
private static void onShutdown() {
terminated = true;
RuntimeException root = null;
for (Database database : DATABASES.keySet()) {
for (Database database : collectDatabasesToClose()) {
try {
database.close(true);
} catch (RuntimeException e) {
......@@ -94,6 +95,10 @@ class OnExitDatabaseCloser extends Thread {
}
}
private static synchronized Iterable<Database> collectDatabasesToClose() {
return new ArrayList<>(DATABASES.keySet());
}
private OnExitDatabaseCloser() {
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论