Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
d61be971
提交
d61be971
authored
11 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Automated build improvements.
上级
1cba07fa
master
noel-pr1
plus33-master
pr/267
stumc-Issue#576
version-1.4.198
version-1.4.197
version-1.4.196
version-1.4.195
version-1.4.194
version-1.4.193
version-1.4.192
version-1.4.191
version-1.4.190
version-1.4.188
version-1.4.187
version-1.4.186
version-1.4.185
version-1.4.184
version-1.4.183
version-1.4.182
version-1.4.181
version-1.4.178
version-1.4.177
version-1.3
无相关合并请求
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
167 行增加
和
34 行删除
+167
-34
SelfDestructor.java
h2/src/test/org/h2/test/utils/SelfDestructor.java
+38
-31
UploadBuild.java
h2/src/tools/org/h2/build/doc/UploadBuild.java
+3
-3
JavaProcessKiller.java
h2/src/tools/org/h2/dev/util/JavaProcessKiller.java
+126
-0
没有找到文件。
h2/src/test/org/h2/test/utils/SelfDestructor.java
浏览文件 @
d61be971
...
...
@@ -48,47 +48,54 @@ public class SelfDestructor extends Thread {
// ignore
}
}
String
time
=
new
Timestamp
(
System
.
currentTimeMillis
()).
toString
();
System
.
out
.
println
(
time
+
" Killing the process after "
+
minutes
+
" minute(s)"
);
try
{
Map
<
Thread
,
StackTraceElement
[]>
map
=
Thread
.
getAllStackTraces
();
for
(
Map
.
Entry
<
Thread
,
StackTraceElement
[]>
en
:
map
.
entrySet
())
{
System
.
out
.
println
(
en
.
getKey
());
for
(
StackTraceElement
el
:
en
.
getValue
())
{
System
.
out
.
println
(
" "
+
el
);
String
time
=
new
Timestamp
(
System
.
currentTimeMillis
()).
toString
();
System
.
out
.
println
(
time
+
" Killing the process after "
+
minutes
+
" minute(s)"
);
try
{
Map
<
Thread
,
StackTraceElement
[]>
map
=
Thread
.
getAllStackTraces
();
for
(
Map
.
Entry
<
Thread
,
StackTraceElement
[]>
en
:
map
.
entrySet
())
{
System
.
out
.
println
(
en
.
getKey
());
for
(
StackTraceElement
el
:
en
.
getValue
())
{
System
.
out
.
println
(
" "
+
el
);
}
}
System
.
out
.
println
();
System
.
out
.
flush
();
try
{
Thread
.
sleep
(
1000
);
}
catch
(
Exception
e
)
{
// ignore
}
int
activeCount
=
Thread
.
activeCount
();
Thread
[]
threads
=
new
Thread
[
activeCount
+
100
];
int
len
=
Thread
.
enumerate
(
threads
);
Method
stop
=
Thread
.
class
.
getMethod
(
"stop"
,
Throwable
.
class
);
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
Thread
t
=
threads
[
i
];
String
threadName
=
"Thread #"
+
i
+
": "
+
t
.
getName
();
Error
e
=
new
Error
(
threadName
);
if
(
t
!=
Thread
.
currentThread
())
{
stop
.
invoke
(
t
,
e
);
t
.
interrupt
();
}
}
}
catch
(
Throwable
t
)
{
t
.
printStackTrace
();
// ignore
}
System
.
out
.
println
();
System
.
out
.
flush
();
try
{
Thread
.
sleep
(
1000
);
}
catch
(
Exception
e
)
{
// ignore
}
int
activeCount
=
Thread
.
activeCount
();
Thread
[]
threads
=
new
Thread
[
activeCount
+
100
];
int
len
=
Thread
.
enumerate
(
threads
);
Method
stop
=
Thread
.
class
.
getMethod
(
"stop"
,
Throwable
.
class
);
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
Thread
t
=
threads
[
i
];
String
threadName
=
"Thread #"
+
i
+
": "
+
t
.
getName
();
Error
e
=
new
Error
(
threadName
);
if
(
t
!=
Thread
.
currentThread
())
{
stop
.
invoke
(
t
,
e
);
t
.
interrupt
();
}
}
System
.
out
.
println
(
"Killing the process now"
);
}
catch
(
Throwable
t
)
{
t
.
printStackTrace
();
// ignore
}
try
{
Thread
.
sleep
(
1000
);
}
catch
(
Exception
e
)
{
// ignore
try
{
t
.
printStackTrace
(
System
.
out
);
}
catch
(
Throwable
t2
)
{
// ignore (out of memory)
}
}
System
.
out
.
println
(
"Killing the process now"
);
Runtime
.
getRuntime
().
halt
(
1
);
}
};
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/build/doc/UploadBuild.java
浏览文件 @
d61be971
...
...
@@ -112,12 +112,12 @@ public class UploadBuild {
int
end
=
testOutput
.
indexOf
(
"<br />"
,
idx
);
if
(
end
>=
0
)
{
String
result
=
testOutput
.
substring
(
idx
+
"Statements per second: "
.
length
(),
end
);
now
+=
"
("
+
result
+
" op/s)
"
;
now
+=
"
"
+
result
+
" op/s
"
;
}
}
String
sql
=
"insert into item(title, issued, desc) values('Build "
+
now
+
(
error
?
"
(FAILED)
"
:
""
)
+
(
coverageFailed
?
"
(COVERAGE)
"
:
""
)
+
(
error
?
"
FAILED
"
:
""
)
+
(
coverageFailed
?
"
COVERAGE
"
:
""
)
+
"', '"
+
ts
+
"', '<a href=\"http://www.h2database.com/html/testOutput.html\">Output</a>"
+
" - <a href=\"http://www.h2database.com/coverage/overview.html\">Coverage</a>"
+
" - <a href=\"http://www.h2database.com/automated/h2-latest.jar\">Jar</a>');\n"
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/dev/util/JavaProcessKiller.java
0 → 100644
浏览文件 @
d61be971
/*
* Copyright 2004-2013 H2 Group. Multiple-Licensed under the H2 License,
* Version 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
dev
.
util
;
import
java.io.ByteArrayOutputStream
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.util.Map.Entry
;
import
java.util.TreeMap
;
/**
* Allows to kill a certain Java process.
*/
public
class
JavaProcessKiller
{
/**
* Kill a certain Java process. The JDK (jps) needs to be in the path.
*
* @param args the Java process name as listed by jps -l. If not set the
* Java processes are listed
*/
public
static
void
main
(
String
...
args
)
{
new
JavaProcessKiller
().
run
(
args
);
}
private
void
run
(
String
...
args
)
{
TreeMap
<
Integer
,
String
>
map
=
getProcesses
();
System
.
out
.
println
(
"Processes:"
);
System
.
out
.
println
(
map
);
if
(
args
.
length
==
0
)
{
System
.
out
.
println
(
"Kill a Java process"
);
System
.
out
.
println
(
"Usage: java "
+
getClass
().
getName
()
+
" <name>"
);
return
;
}
String
processName
=
args
[
0
];
int
killCount
=
0
;
for
(
Entry
<
Integer
,
String
>
e
:
map
.
entrySet
())
{
String
name
=
e
.
getValue
();
if
(
name
.
equals
(
processName
))
{
int
pid
=
e
.
getKey
();
System
.
out
.
println
(
"Killing pid "
+
pid
+
"..."
);
// Windows
try
{
exec
(
"taskkill"
,
"/pid"
,
""
+
pid
,
"/f"
);
}
catch
(
Exception
e2
)
{
// ignore
}
// Unix
try
{
exec
(
"kill"
,
"-9"
,
""
+
pid
);
}
catch
(
Exception
e2
)
{
// ignore
}
System
.
out
.
println
(
"done."
);
killCount
++;
}
}
if
(
killCount
==
0
)
{
System
.
out
.
println
(
"Process "
+
processName
+
" not found"
);
}
map
=
getProcesses
();
System
.
out
.
println
(
"Processes now:"
);
System
.
out
.
println
(
map
);
}
private
static
TreeMap
<
Integer
,
String
>
getProcesses
()
{
String
processList
=
exec
(
"jps"
,
"-l"
);
String
[]
processes
=
processList
.
split
(
"\n"
);
TreeMap
<
Integer
,
String
>
map
=
new
TreeMap
<
Integer
,
String
>();
for
(
int
i
=
0
;
i
<
processes
.
length
;
i
++)
{
String
p
=
processes
[
i
].
trim
();
int
idx
=
p
.
indexOf
(
' '
);
if
(
idx
>
0
)
{
int
pid
=
Integer
.
parseInt
(
p
.
substring
(
0
,
idx
));
String
n
=
p
.
substring
(
idx
+
1
);
map
.
put
(
pid
,
n
);
}
}
return
map
;
}
private
static
String
exec
(
String
...
args
)
{
ByteArrayOutputStream
err
=
new
ByteArrayOutputStream
();
ByteArrayOutputStream
out
=
new
ByteArrayOutputStream
();
try
{
Process
p
=
Runtime
.
getRuntime
().
exec
(
args
);
copyInThread
(
p
.
getInputStream
(),
out
);
copyInThread
(
p
.
getErrorStream
(),
err
);
p
.
waitFor
();
String
e
=
new
String
(
err
.
toByteArray
(),
"UTF-8"
);
if
(
e
.
length
()
>
0
)
{
throw
new
RuntimeException
(
e
);
}
String
output
=
new
String
(
out
.
toByteArray
(),
"UTF-8"
);
return
output
;
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
}
private
static
void
copyInThread
(
final
InputStream
in
,
final
OutputStream
out
)
{
new
Thread
(
"Profiler stream copy"
)
{
@Override
public
void
run
()
{
byte
[]
buffer
=
new
byte
[
4096
];
try
{
while
(
true
)
{
int
len
=
in
.
read
(
buffer
,
0
,
buffer
.
length
);
if
(
len
<
0
)
{
break
;
}
out
.
write
(
buffer
,
0
,
len
);
}
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
}
}.
run
();
}
}
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论