提交 dc45888c authored 作者: Thomas Mueller Graf's avatar Thomas Mueller Graf

Fix OpenClose test case

上级 b71c93ff
...@@ -1132,10 +1132,13 @@ public class Database implements DataHandler { ...@@ -1132,10 +1132,13 @@ public class Database implements DataHandler {
* Create a session for the given user. * Create a session for the given user.
* *
* @param user the user * @param user the user
* @return the session * @return the session, or null if the database is currently closing
* @throws DbException if the database is in exclusive mode * @throws DbException if the database is in exclusive mode
*/ */
synchronized Session createSession(User user) { synchronized Session createSession(User user) {
if (closing) {
return null;
}
if (exclusiveSession != null) { if (exclusiveSession != null) {
throw DbException.get(ErrorCode.DATABASE_IS_IN_EXCLUSIVE_MODE); throw DbException.get(ErrorCode.DATABASE_IS_IN_EXCLUSIVE_MODE);
} }
......
...@@ -109,6 +109,10 @@ public class Engine implements SessionFactory { ...@@ -109,6 +109,10 @@ public class Engine implements SessionFactory {
} }
checkClustering(ci, database); checkClustering(ci, database);
Session session = database.createSession(user); Session session = database.createSession(user);
if (session == null) {
// concurrently closing
return null;
}
if (ci.getProperty("JMX", false)) { if (ci.getProperty("JMX", false)) {
try { try {
Utils.callStaticMethod( Utils.callStaticMethod(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论