Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
7146e176
提交
7146e176
authored
2月 03, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
The WebServlet did not close the database when undeploying the web application.
上级
a8693704
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
40 行增加
和
36 行删除
+40
-36
WebServer.java
h2/src/main/org/h2/server/web/WebServer.java
+15
-21
WebServlet.java
h2/src/main/org/h2/server/web/WebServlet.java
+4
-0
WebSession.java
h2/src/main/org/h2/server/web/WebSession.java
+19
-13
WebThread.java
h2/src/main/org/h2/server/web/WebThread.java
+2
-2
没有找到文件。
h2/src/main/org/h2/server/web/WebServer.java
浏览文件 @
7146e176
...
@@ -15,7 +15,6 @@ import java.net.ServerSocket;
...
@@ -15,7 +15,6 @@ import java.net.ServerSocket;
import
java.net.Socket
;
import
java.net.Socket
;
import
java.sql.Connection
;
import
java.sql.Connection
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Collections
;
...
@@ -332,12 +331,14 @@ public class WebServer implements Service {
...
@@ -332,12 +331,14 @@ public class WebServer implements Service {
}
}
public
void
stop
()
{
public
void
stop
()
{
try
{
if
(
serverSocket
!=
null
)
{
serverSocket
.
close
();
try
{
}
catch
(
IOException
e
)
{
serverSocket
.
close
();
// TODO log exception
}
catch
(
IOException
e
)
{
traceError
(
e
);
}
serverSocket
=
null
;
}
}
serverSocket
=
null
;
if
(
listenerThread
!=
null
)
{
if
(
listenerThread
!=
null
)
{
try
{
try
{
listenerThread
.
join
(
1000
);
listenerThread
.
join
(
1000
);
...
@@ -349,14 +350,7 @@ public class WebServer implements Service {
...
@@ -349,14 +350,7 @@ public class WebServer implements Service {
ArrayList
list
=
new
ArrayList
(
sessions
.
values
());
ArrayList
list
=
new
ArrayList
(
sessions
.
values
());
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
WebSession
session
=
(
WebSession
)
list
.
get
(
i
);
WebSession
session
=
(
WebSession
)
list
.
get
(
i
);
Statement
stat
=
session
.
executingStatement
;
session
.
close
();
if
(
stat
!=
null
)
{
try
{
stat
.
cancel
();
}
catch
(
Exception
e
)
{
// ignore
}
}
}
}
list
=
new
ArrayList
(
running
);
list
=
new
ArrayList
(
running
);
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
...
@@ -365,8 +359,7 @@ public class WebServer implements Service {
...
@@ -365,8 +359,7 @@ public class WebServer implements Service {
c
.
stopNow
();
c
.
stopNow
();
c
.
join
(
100
);
c
.
join
(
100
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
// TODO log exception
traceError
(
e
);
e
.
printStackTrace
();
}
}
}
}
}
}
...
@@ -387,8 +380,10 @@ public class WebServer implements Service {
...
@@ -387,8 +380,10 @@ public class WebServer implements Service {
*
*
* @param e the exception
* @param e the exception
*/
*/
void
traceError
(
Exception
e
)
{
void
traceError
(
Throwable
e
)
{
e
.
printStackTrace
();
if
(
trace
)
{
e
.
printStackTrace
();
}
}
}
/**
/**
...
@@ -676,7 +671,7 @@ public class WebServer implements Service {
...
@@ -676,7 +671,7 @@ public class WebServer implements Service {
* The translate thread reads and writes the file translation.properties
* The translate thread reads and writes the file translation.properties
* once a second.
* once a second.
*/
*/
private
static
class
TranslateThread
extends
Thread
{
private
class
TranslateThread
extends
Thread
{
private
final
File
file
=
new
File
(
"translation.properties"
);
private
final
File
file
=
new
File
(
"translation.properties"
);
private
final
Map
translation
;
private
final
Map
translation
;
...
@@ -714,8 +709,7 @@ public class WebServer implements Service {
...
@@ -714,8 +709,7 @@ public class WebServer implements Service {
}
}
Thread
.
sleep
(
1000
);
Thread
.
sleep
(
1000
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
traceError
(
e
);
// ignore
}
}
}
}
}
}
...
...
h2/src/main/org/h2/server/web/WebServlet.java
浏览文件 @
7146e176
...
@@ -53,6 +53,10 @@ public class WebServlet extends HttpServlet {
...
@@ -53,6 +53,10 @@ public class WebServlet extends HttpServlet {
server
.
init
(
args
);
server
.
init
(
args
);
}
}
public
void
destroy
()
{
server
.
stop
();
}
private
boolean
allow
(
HttpServletRequest
req
)
{
private
boolean
allow
(
HttpServletRequest
req
)
{
if
(
server
.
getAllowOthers
())
{
if
(
server
.
getAllowOthers
())
{
return
true
;
return
true
;
...
...
h2/src/main/org/h2/server/web/WebSession.java
浏览文件 @
7146e176
...
@@ -125,29 +125,17 @@ class WebSession {
...
@@ -125,29 +125,17 @@ class WebSession {
tableRule
=
new
DbContextRule
(
contents
,
DbContextRule
.
TABLE
);
tableRule
=
new
DbContextRule
(
contents
,
DbContextRule
.
TABLE
);
schemaRule
=
new
DbContextRule
(
contents
,
DbContextRule
.
SCHEMA
);
schemaRule
=
new
DbContextRule
(
contents
,
DbContextRule
.
SCHEMA
);
columnAliasRule
=
new
DbContextRule
(
contents
,
DbContextRule
.
COLUMN_ALIAS
);
columnAliasRule
=
new
DbContextRule
(
contents
,
DbContextRule
.
COLUMN_ALIAS
);
// bnf.updateTopic("newTableName", new String[]{"TEST"});
// String[] schemas;
// if(contents.isMySQL) {
// schemas = new String[0];
// } else {
// schemas = new String[contents.schemas.length];
// for(int i=0; i<contents.schemas.length; i++) {
// schemas[i] = contents.schemas[i].quotedName + ".";
// }
// }
// bnf.updateTopic("schemaName", schemas);
newBnf
.
updateTopic
(
"columnName"
,
columnRule
);
newBnf
.
updateTopic
(
"columnName"
,
columnRule
);
newBnf
.
updateTopic
(
"newTableAlias"
,
newAliasRule
);
newBnf
.
updateTopic
(
"newTableAlias"
,
newAliasRule
);
newBnf
.
updateTopic
(
"tableAlias"
,
aliasRule
);
newBnf
.
updateTopic
(
"tableAlias"
,
aliasRule
);
newBnf
.
updateTopic
(
"columnAlias"
,
columnAliasRule
);
newBnf
.
updateTopic
(
"columnAlias"
,
columnAliasRule
);
newBnf
.
updateTopic
(
"tableName"
,
tableRule
);
newBnf
.
updateTopic
(
"tableName"
,
tableRule
);
newBnf
.
updateTopic
(
"schemaName"
,
schemaRule
);
newBnf
.
updateTopic
(
"schemaName"
,
schemaRule
);
// bnf.updateTopic("name", new String[]{""});
newBnf
.
linkStatements
();
newBnf
.
linkStatements
();
bnf
=
newBnf
;
bnf
=
newBnf
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
// ok we don't have the bnf
// ok we don't have the bnf
e
.
printStackTrace
(
);
server
.
traceError
(
e
);
}
}
}
}
...
@@ -246,4 +234,22 @@ class WebSession {
...
@@ -246,4 +234,22 @@ class WebSession {
return
shutdownServerOnDisconnect
;
return
shutdownServerOnDisconnect
;
}
}
void
close
()
{
if
(
executingStatement
!=
null
)
{
try
{
executingStatement
.
cancel
();
}
catch
(
Exception
e
)
{
// ignore
}
}
if
(
conn
!=
null
)
{
try
{
conn
.
close
();
}
catch
(
Exception
e
)
{
// ignore
}
}
}
}
}
h2/src/main/org/h2/server/web/WebThread.java
浏览文件 @
7146e176
...
@@ -552,7 +552,7 @@ class WebThread extends Thread implements DatabaseEventListener {
...
@@ -552,7 +552,7 @@ class WebThread extends Thread implements DatabaseEventListener {
}
}
session
.
put
(
"autoCompleteList"
,
result
);
session
.
put
(
"autoCompleteList"
,
result
);
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
e
.
printStackTrace
(
);
server
.
traceError
(
e
);
}
}
return
"autoCompleteList.jsp"
;
return
"autoCompleteList.jsp"
;
}
}
...
@@ -974,7 +974,7 @@ class WebThread extends Thread implements DatabaseEventListener {
...
@@ -974,7 +974,7 @@ class WebThread extends Thread implements DatabaseEventListener {
error
=
formatAsError
(
error
);
error
=
formatAsError
(
error
);
return
error
;
return
error
;
}
catch
(
OutOfMemoryError
e2
)
{
}
catch
(
OutOfMemoryError
e2
)
{
e
.
printStackTrace
(
);
server
.
traceError
(
e
);
return
e
.
toString
();
return
e
.
toString
();
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论