Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
8ca7992f
提交
8ca7992f
authored
12月 09, 2016
作者:
Noel Grandin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
try to fix CI
上级
fd3217c3
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
7 行增加
和
9 行删除
+7
-9
TestMultiThread.java
h2/src/test/org/h2/test/db/TestMultiThread.java
+7
-9
没有找到文件。
h2/src/test/org/h2/test/db/TestMultiThread.java
浏览文件 @
8ca7992f
...
@@ -389,7 +389,7 @@ public class TestMultiThread extends TestBase implements Runnable {
...
@@ -389,7 +389,7 @@ public class TestMultiThread extends TestBase implements Runnable {
"CREATE TABLE IF NOT EXISTS TRAN (ID NUMBER(18,0) not null PRIMARY KEY)"
);
"CREATE TABLE IF NOT EXISTS TRAN (ID NUMBER(18,0) not null PRIMARY KEY)"
);
final
int
threadCount
=
100
;
final
int
threadCount
=
100
;
final
ArrayList
<
Callable
<
Integer
>>
callables
=
new
ArrayList
<
Callable
<
Integer
>>();
final
ArrayList
<
Callable
<
Void
>>
callables
=
new
ArrayList
<
Callable
<
Void
>>();
for
(
int
i
=
0
;
i
<
threadCount
;
i
++)
{
for
(
int
i
=
0
;
i
<
threadCount
;
i
++)
{
final
Connection
taskConn
=
getConnection
(
url
);
final
Connection
taskConn
=
getConnection
(
url
);
taskConn
.
setAutoCommit
(
false
);
taskConn
.
setAutoCommit
(
false
);
...
@@ -397,9 +397,9 @@ public class TestMultiThread extends TestBase implements Runnable {
...
@@ -397,9 +397,9 @@ public class TestMultiThread extends TestBase implements Runnable {
.
prepareStatement
(
"INSERT INTO tran (id) values(?)"
);
.
prepareStatement
(
"INSERT INTO tran (id) values(?)"
);
// to guarantee uniqueness
// to guarantee uniqueness
final
long
initialTransactionId
=
i
*
1000000L
;
final
long
initialTransactionId
=
i
*
1000000L
;
callables
.
add
(
new
Callable
<
Integer
>()
{
callables
.
add
(
new
Callable
<
Void
>()
{
@Override
@Override
public
Integer
call
()
throws
Exception
{
public
Void
call
()
throws
Exception
{
long
tranId
=
initialTransactionId
;
long
tranId
=
initialTransactionId
;
for
(
int
j
=
0
;
j
<
10000
;
j
++)
{
for
(
int
j
=
0
;
j
<
10000
;
j
++)
{
insertTranStmt
.
setLong
(
1
,
tranId
++);
insertTranStmt
.
setLong
(
1
,
tranId
++);
...
@@ -407,7 +407,7 @@ public class TestMultiThread extends TestBase implements Runnable {
...
@@ -407,7 +407,7 @@ public class TestMultiThread extends TestBase implements Runnable {
taskConn
.
commit
();
taskConn
.
commit
();
}
}
taskConn
.
close
();
taskConn
.
close
();
return
1
;
return
null
;
}
}
});
});
}
}
...
@@ -415,15 +415,13 @@ public class TestMultiThread extends TestBase implements Runnable {
...
@@ -415,15 +415,13 @@ public class TestMultiThread extends TestBase implements Runnable {
final
ExecutorService
executor
=
Executors
final
ExecutorService
executor
=
Executors
.
newFixedThreadPool
(
threadCount
);
.
newFixedThreadPool
(
threadCount
);
try
{
try
{
final
ArrayList
<
Future
<
Integer
>>
jobs
=
new
ArrayList
<
Future
<
Integer
>>();
final
ArrayList
<
Future
<
Void
>>
jobs
=
new
ArrayList
<
Future
<
Void
>>();
for
(
int
i
=
0
;
i
<
threadCount
;
i
++)
{
for
(
int
i
=
0
;
i
<
threadCount
;
i
++)
{
jobs
.
add
(
executor
.
submit
(
callables
.
get
(
i
)));
jobs
.
add
(
executor
.
submit
(
callables
.
get
(
i
)));
}
}
// check for exceptions
// check for exceptions
for
(
Future
<
Integer
>
job
:
jobs
)
{
for
(
Future
<
Void
>
job
:
jobs
)
{
if
(
job
.
get
(
180
,
TimeUnit
.
SECONDS
)
==
null
)
{
job
.
get
(
5
,
TimeUnit
.
MINUTES
);
throw
new
RuntimeException
(
"timed out"
);
}
}
}
}
finally
{
}
finally
{
conn
.
close
();
conn
.
close
();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论