提交 fe1e4d93 authored 作者: Thomas Mueller's avatar Thomas Mueller

New system property h2.maxReconnect.

上级 23e0c62d
......@@ -1027,7 +1027,11 @@ public class Database implements DataHandler {
* hook
*/
synchronized void close(boolean fromShutdownHook) {
if (closing) {
return;
}
closing = true;
stopServer();
if (userSessions.size() > 0) {
if (!fromShutdownHook) {
return;
......@@ -1061,7 +1065,6 @@ public class Database implements DataHandler {
}
closing = true;
}
stopServer();
try {
if (systemSession != null) {
ObjectArray tablesAndViews = getAllSchemaObjects(DbObject.TABLE_OR_VIEW);
......@@ -2078,5 +2081,9 @@ public class Database implements DataHandler {
}
return TableLinkConnection.open(linkConnections, driver, url, user, password);
}
public String toString() {
return databaseShortName + ":" + super.toString();
}
}
......@@ -154,6 +154,15 @@ public class Session implements SessionInterface {
Value v = (Value) variables.get(name);
return v == null ? ValueNull.INSTANCE : v;
}
public String[] getVariableNames() {
if (variables == null) {
return new String[0];
}
String[] list = new String[variables.size()];
variables.keySet().toArray(list);
return list;
}
/**
* Get the local temporary table if one exists with that name, or null if
......
......@@ -62,8 +62,8 @@ public class TestAutoReconnect extends TestBase {
"AUTO_SERVER=TRUE;OPEN_NEW=TRUE";
restart();
} else {
server = Server.createTcpServer(null).start();
url = "jdbc:h2:tcp://localhost/" + baseDir + "/autoReconnect;" +
server = Server.createTcpServer(new String[]{"-tcpPort", "8181"}).start();
url = "jdbc:h2:tcp://localhost:8181/" + baseDir + "/autoReconnect;" +
"FILE_LOCK=SOCKET;AUTO_RECONNECT=TRUE";
}
Connection conn = DriverManager.getConnection(url);
......
......@@ -62,14 +62,15 @@ public class TestAutoServer extends TestBase {
Connection conn = getConnection(url + ";OPEN_NEW=TRUE");
Statement stat = conn.createStatement();
try {
stat.execute("SHUTDOWN");
} catch (SQLException e) {
assertKnownException(e);
// the connection is closed
if (config.big) {
try {
stat.execute("SHUTDOWN");
} catch (SQLException e) {
assertKnownException(e);
// the connection is closed
}
}
conn.close();
connServer.close();
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论