Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
b0239c0b
提交
b0239c0b
authored
12月 17, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improved self destructor
上级
0f3ef9e3
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
22 行增加
和
17 行删除
+22
-17
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+1
-1
Task.java
h2/src/test/org/h2/test/db/Task.java
+1
-1
TaskProcess.java
h2/src/test/org/h2/test/db/TaskProcess.java
+1
-1
TestHalt.java
h2/src/test/org/h2/test/synth/TestHalt.java
+1
-1
TestHaltApp.java
h2/src/test/org/h2/test/synth/TestHaltApp.java
+1
-1
TestKill.java
h2/src/test/org/h2/test/synth/TestKill.java
+1
-1
TestKillProcess.java
h2/src/test/org/h2/test/synth/TestKillProcess.java
+1
-1
TestKillRestart.java
h2/src/test/org/h2/test/synth/TestKillRestart.java
+1
-1
TestKillRestartMulti.java
h2/src/test/org/h2/test/synth/TestKillRestartMulti.java
+1
-1
TestExit.java
h2/src/test/org/h2/test/unit/TestExit.java
+1
-0
SelfDestructor.java
h2/src/test/org/h2/test/utils/SelfDestructor.java
+12
-8
没有找到文件。
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
b0239c0b
...
@@ -101,7 +101,6 @@ import org.h2.test.synth.TestRandomSQL;
...
@@ -101,7 +101,6 @@ import org.h2.test.synth.TestRandomSQL;
import
org.h2.test.synth.TestTimer
;
import
org.h2.test.synth.TestTimer
;
import
org.h2.test.synth.sql.TestSynth
;
import
org.h2.test.synth.sql.TestSynth
;
import
org.h2.test.synth.thread.TestMulti
;
import
org.h2.test.synth.thread.TestMulti
;
import
org.h2.test.unit.SelfDestructor
;
import
org.h2.test.unit.TestAutoReconnect
;
import
org.h2.test.unit.TestAutoReconnect
;
import
org.h2.test.unit.TestBitField
;
import
org.h2.test.unit.TestBitField
;
import
org.h2.test.unit.TestCache
;
import
org.h2.test.unit.TestCache
;
...
@@ -137,6 +136,7 @@ import org.h2.test.unit.TestValue;
...
@@ -137,6 +136,7 @@ import org.h2.test.unit.TestValue;
import
org.h2.test.unit.TestValueHashMap
;
import
org.h2.test.unit.TestValueHashMap
;
import
org.h2.test.unit.TestValueMemory
;
import
org.h2.test.unit.TestValueMemory
;
import
org.h2.test.utils.OutputCatcher
;
import
org.h2.test.utils.OutputCatcher
;
import
org.h2.test.utils.SelfDestructor
;
import
org.h2.tools.DeleteDbFiles
;
import
org.h2.tools.DeleteDbFiles
;
import
org.h2.tools.Server
;
import
org.h2.tools.Server
;
import
org.h2.util.MemoryUtils
;
import
org.h2.util.MemoryUtils
;
...
...
h2/src/test/org/h2/test/db/Task.java
浏览文件 @
b0239c0b
...
@@ -9,7 +9,7 @@ package org.h2.test.db;
...
@@ -9,7 +9,7 @@ package org.h2.test.db;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.io.InputStreamReader
;
import
org.h2.test.u
nit
.SelfDestructor
;
import
org.h2.test.u
tils
.SelfDestructor
;
/**
/**
* A task that can be run as a separate process.
* A task that can be run as a separate process.
...
...
h2/src/test/org/h2/test/db/TaskProcess.java
浏览文件 @
b0239c0b
...
@@ -16,7 +16,7 @@ import java.io.OutputStream;
...
@@ -16,7 +16,7 @@ import java.io.OutputStream;
import
java.io.OutputStreamWriter
;
import
java.io.OutputStreamWriter
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
org.h2.test.u
nit
.SelfDestructor
;
import
org.h2.test.u
tils
.SelfDestructor
;
import
org.h2.util.StringUtils
;
import
org.h2.util.StringUtils
;
/**
/**
...
...
h2/src/test/org/h2/test/synth/TestHalt.java
浏览文件 @
b0239c0b
...
@@ -20,7 +20,7 @@ import java.util.Random;
...
@@ -20,7 +20,7 @@ import java.util.Random;
import
org.h2.test.TestAll
;
import
org.h2.test.TestAll
;
import
org.h2.test.TestBase
;
import
org.h2.test.TestBase
;
import
org.h2.test.u
nit
.SelfDestructor
;
import
org.h2.test.u
tils
.SelfDestructor
;
import
org.h2.tools.Backup
;
import
org.h2.tools.Backup
;
import
org.h2.tools.DeleteDbFiles
;
import
org.h2.tools.DeleteDbFiles
;
import
org.h2.util.IOUtils
;
import
org.h2.util.IOUtils
;
...
...
h2/src/test/org/h2/test/synth/TestHaltApp.java
浏览文件 @
b0239c0b
...
@@ -11,7 +11,7 @@ import java.sql.ResultSet;
...
@@ -11,7 +11,7 @@ import java.sql.ResultSet;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.sql.Statement
;
import
org.h2.test.u
nit
.SelfDestructor
;
import
org.h2.test.u
tils
.SelfDestructor
;
/**
/**
* The application code for the {@link TestHalt} application.
* The application code for the {@link TestHalt} application.
...
...
h2/src/test/org/h2/test/synth/TestKill.java
浏览文件 @
b0239c0b
...
@@ -14,7 +14,7 @@ import java.sql.Statement;
...
@@ -14,7 +14,7 @@ import java.sql.Statement;
import
java.util.Random
;
import
java.util.Random
;
import
org.h2.test.TestBase
;
import
org.h2.test.TestBase
;
import
org.h2.test.u
nit
.SelfDestructor
;
import
org.h2.test.u
tils
.SelfDestructor
;
/**
/**
* A random recovery test. This test starts a process that executes random
* A random recovery test. This test starts a process that executes random
...
...
h2/src/test/org/h2/test/synth/TestKillProcess.java
浏览文件 @
b0239c0b
...
@@ -13,7 +13,7 @@ import java.util.ArrayList;
...
@@ -13,7 +13,7 @@ import java.util.ArrayList;
import
java.util.Random
;
import
java.util.Random
;
import
org.h2.store.FileLister
;
import
org.h2.store.FileLister
;
import
org.h2.test.TestBase
;
import
org.h2.test.TestBase
;
import
org.h2.test.u
nit
.SelfDestructor
;
import
org.h2.test.u
tils
.SelfDestructor
;
/**
/**
* Test application for TestKill.
* Test application for TestKill.
...
...
h2/src/test/org/h2/test/synth/TestKillRestart.java
浏览文件 @
b0239c0b
...
@@ -14,7 +14,7 @@ import java.sql.ResultSet;
...
@@ -14,7 +14,7 @@ import java.sql.ResultSet;
import
java.sql.Statement
;
import
java.sql.Statement
;
import
java.util.Random
;
import
java.util.Random
;
import
org.h2.test.TestBase
;
import
org.h2.test.TestBase
;
import
org.h2.test.u
nit
.SelfDestructor
;
import
org.h2.test.u
tils
.SelfDestructor
;
/**
/**
* Standalone recovery test. A new process is started and then killed while it
* Standalone recovery test. A new process is started and then killed while it
...
...
h2/src/test/org/h2/test/synth/TestKillRestartMulti.java
浏览文件 @
b0239c0b
...
@@ -17,7 +17,7 @@ import java.util.Random;
...
@@ -17,7 +17,7 @@ import java.util.Random;
import
org.h2.constant.ErrorCode
;
import
org.h2.constant.ErrorCode
;
import
org.h2.test.TestBase
;
import
org.h2.test.TestBase
;
import
org.h2.test.u
nit
.SelfDestructor
;
import
org.h2.test.u
tils
.SelfDestructor
;
import
org.h2.tools.Backup
;
import
org.h2.tools.Backup
;
import
org.h2.util.FileUtils
;
import
org.h2.util.FileUtils
;
import
org.h2.util.New
;
import
org.h2.util.New
;
...
...
h2/src/test/org/h2/test/unit/TestExit.java
浏览文件 @
b0239c0b
...
@@ -14,6 +14,7 @@ import java.sql.SQLException;
...
@@ -14,6 +14,7 @@ import java.sql.SQLException;
import
org.h2.api.DatabaseEventListener
;
import
org.h2.api.DatabaseEventListener
;
import
org.h2.test.TestBase
;
import
org.h2.test.TestBase
;
import
org.h2.test.utils.SelfDestructor
;
/**
/**
* Tests the flag db_close_on_exit.
* Tests the flag db_close_on_exit.
...
...
h2/src/test/org/h2/test/u
nit
/SelfDestructor.java
→
h2/src/test/org/h2/test/u
tils
/SelfDestructor.java
浏览文件 @
b0239c0b
...
@@ -4,10 +4,11 @@
...
@@ -4,10 +4,11 @@
* (http://h2database.com/html/license.html).
* (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
* Initial Developer: H2 Group
*/
*/
package
org
.
h2
.
test
.
u
nit
;
package
org
.
h2
.
test
.
u
tils
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
import
java.util.Map
;
/**
/**
* This is a self-destructor class to kill a long running process automatically
* This is a self-destructor class to kill a long running process automatically
...
@@ -49,20 +50,23 @@ public class SelfDestructor extends Thread {
...
@@ -49,20 +50,23 @@ public class SelfDestructor extends Thread {
String
time
=
new
Timestamp
(
System
.
currentTimeMillis
()).
toString
();
String
time
=
new
Timestamp
(
System
.
currentTimeMillis
()).
toString
();
System
.
out
.
println
(
time
+
" Killing the process after "
+
minutes
+
" minute(s)"
);
System
.
out
.
println
(
time
+
" Killing the process after "
+
minutes
+
" minute(s)"
);
try
{
try
{
int
activeCount
=
Thread
.
activeCount
();
Map
<
Thread
,
StackTraceElement
[]>
map
=
Thread
.
getAllStackTraces
();
Thread
[]
threads
=
new
Thread
[
activeCount
+
100
];
for
(
Map
.
Entry
<
Thread
,
StackTraceElement
[]>
en
:
map
.
entrySet
())
{
int
len
=
Thread
.
enumerate
(
threads
);
System
.
out
.
println
(
en
.
getKey
());
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
for
(
StackTraceElement
el
:
en
.
getValue
())
{
Thread
t
=
threads
[
i
];
System
.
out
.
println
(
" "
+
el
);
String
threadName
=
"Thread #"
+
i
+
": "
+
t
.
getName
();
}
System
.
out
.
println
(
threadName
);
}
}
System
.
out
.
println
();
System
.
out
.
flush
();
System
.
out
.
flush
();
try
{
try
{
Thread
.
sleep
(
1000
);
Thread
.
sleep
(
1000
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
// ignore
// ignore
}
}
int
activeCount
=
Thread
.
activeCount
();
Thread
[]
threads
=
new
Thread
[
activeCount
+
100
];
int
len
=
Thread
.
enumerate
(
threads
);
Method
stop
=
Thread
.
class
.
getMethod
(
"stop"
,
Throwable
.
class
);
Method
stop
=
Thread
.
class
.
getMethod
(
"stop"
,
Throwable
.
class
);
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
Thread
t
=
threads
[
i
];
Thread
t
=
threads
[
i
];
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论