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

New system property h2.maxReconnect.

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