提交 424af0db authored 作者: Noel Grandin's avatar Noel Grandin 提交者: GitHub

Merge pull request #561 from andreitokar/issue#560

Issue#560 thread leak
...@@ -292,14 +292,16 @@ public class Database implements DataHandler { ...@@ -292,14 +292,16 @@ public class Database implements DataHandler {
if (e instanceof OutOfMemoryError) { if (e instanceof OutOfMemoryError) {
e.fillInStackTrace(); e.fillInStackTrace();
} }
boolean alreadyOpen = e instanceof DbException
&& ((DbException)e).getErrorCode() == ErrorCode.DATABASE_ALREADY_OPEN_1;
if (alreadyOpen) {
stopServer();
}
if (traceSystem != null) { if (traceSystem != null) {
if (e instanceof SQLException) { if (e instanceof DbException && !alreadyOpen) {
SQLException e2 = (SQLException) e; // only write if the database is not already in use
if (e2.getErrorCode() != ErrorCode. trace.error(e, "opening {0}", databaseName);
DATABASE_ALREADY_OPEN_1) {
// only write if the database is not already in use
trace.error(e, "opening {0}", databaseName);
}
} }
traceSystem.close(); traceSystem.close();
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论