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

Improved support for GAE for Java thanks to Vince Bonfanti.

上级 195c8b6e
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -48,11 +48,19 @@ class WebThread extends WebApp implements Runnable { ...@@ -48,11 +48,19 @@ class WebThread extends WebApp implements Runnable {
thread = new Thread(this, "H2 Console thread"); thread = new Thread(this, "H2 Console thread");
} }
public void start() { /**
* Start the thread.
*/
void start() {
thread.start(); thread.start();
} }
public void join(int millis) throws InterruptedException { /**
* Wait until the thread is stopped.
*
* @param millis the maximum number of milliseconds to wait
*/
void join(int millis) throws InterruptedException {
thread.join(millis); thread.join(millis);
} }
...@@ -277,33 +285,14 @@ class WebThread extends WebApp implements Runnable { ...@@ -277,33 +285,14 @@ class WebThread extends WebApp implements Runnable {
return super.adminShutdown(); return super.adminShutdown();
} }
protected String login() { protected boolean loginAsync(final String driver, final String url, final String user, final String password) {
final String driver = attributes.getProperty("driver", ""); if (socket == null
final String url = attributes.getProperty("url", ""); || !url.startsWith("jdbc:h2:")
final String user = attributes.getProperty("user", ""); || url.startsWith("jdbc:h2:tcp:")
final String password = attributes.getProperty("password", ""); || url.startsWith("jdbc:h2:ssl:")
session.put("autoCommit", "checked"); || url.startsWith("jdbc:h2:mem:")) {
session.put("autoComplete", "1"); // async login only possible for H2 embedded
session.put("maxrows", "1000"); return false;
boolean thread = false;
if (socket != null && url.startsWith("jdbc:h2:") && !url.startsWith("jdbc:h2:tcp:")
&& !url.startsWith("jdbc:h2:ssl:") && !url.startsWith("jdbc:h2:mem:")) {
thread = true;
}
if (!thread) {
boolean isH2 = url.startsWith("jdbc:h2:");
try {
Connection conn = server.getConnection(driver, url, user, password, this);
session.setConnection(conn);
session.put("url", url);
session.put("user", user);
session.remove("error");
settingSave();
return "frame.jsp";
} catch (Exception e) {
session.put("error", getLoginError(e, isH2));
return "login.jsp";
}
} }
/** /**
...@@ -422,7 +411,7 @@ class WebThread extends WebApp implements Runnable { ...@@ -422,7 +411,7 @@ class WebThread extends WebApp implements Runnable {
} catch (IOException e) { } catch (IOException e) {
// ignore // ignore
} }
return ""; return true;
} }
private boolean allow() { private boolean allow() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论