Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
ea710513
提交
ea710513
authored
7 年前
作者:
andrei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
just removed useless throw Exception etc. to make IDE happy
上级
e9cebe85
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
27 行增加
和
33 行删除
+27
-33
TestConcurrent.java
h2/src/test/org/h2/test/store/TestConcurrent.java
+27
-33
没有找到文件。
h2/src/test/org/h2/test/store/TestConcurrent.java
浏览文件 @
ea710513
...
...
@@ -41,7 +41,13 @@ public class TestConcurrent extends TestMVStore {
* @param a ignored
*/
public
static
void
main
(
String
...
a
)
throws
Exception
{
TestBase
.
createCaller
().
init
().
test
();
TestBase
init
=
TestBase
.
createCaller
().
init
();
init
.
config
.
memory
=
true
;
init
.
config
.
multiThreaded
=
true
;
for
(
int
i
=
0
;
i
<
1000
;
i
++)
{
System
.
out
.
println
(
"Pass #"
+
i
);
init
.
test
();
}
}
@Override
...
...
@@ -64,7 +70,7 @@ public class TestConcurrent extends TestMVStore {
testConcurrentRead
();
}
private
void
testInterruptReopen
()
throws
Exception
{
private
void
testInterruptReopen
()
{
String
fileName
=
"retry:nio:"
+
getBaseDir
()
+
"/"
+
getTestName
();
FileUtils
.
delete
(
fileName
);
final
MVStore
s
=
new
MVStore
.
Builder
().
...
...
@@ -95,7 +101,7 @@ public class TestConcurrent extends TestMVStore {
}
}
private
void
testConcurrentSaveCompact
()
throws
Exception
{
private
void
testConcurrentSaveCompact
()
{
String
fileName
=
"memFS:"
+
getTestName
();
FileUtils
.
delete
(
fileName
);
final
MVStore
s
=
new
MVStore
.
Builder
().
...
...
@@ -107,7 +113,7 @@ public class TestConcurrent extends TestMVStore {
final
MVMap
<
Integer
,
Integer
>
dataMap
=
s
.
openMap
(
"data"
);
Task
task
=
new
Task
()
{
@Override
public
void
call
()
throws
Exception
{
public
void
call
()
{
int
i
=
0
;
while
(!
stop
)
{
s
.
compact
(
100
,
1024
*
1024
);
...
...
@@ -152,7 +158,7 @@ public class TestConcurrent extends TestMVStore {
for
(
int
i
=
0
;
i
<
tasks
.
length
;
i
++)
{
tasks
[
i
]
=
new
Task
()
{
@Override
public
void
call
()
throws
Exception
{
public
void
call
()
{
Random
r
=
new
Random
();
WriteBuffer
buff
=
new
WriteBuffer
();
while
(!
stop
)
{
...
...
@@ -198,7 +204,7 @@ public class TestConcurrent extends TestMVStore {
s
.
setAutoCommitDelay
(
1
);
Task
task
=
new
Task
()
{
@Override
public
void
call
()
throws
Exception
{
public
void
call
()
{
while
(!
stop
)
{
s
.
compact
(
100
,
1024
*
1024
);
}
...
...
@@ -210,7 +216,7 @@ public class TestConcurrent extends TestMVStore {
final
AtomicInteger
counter
=
new
AtomicInteger
();
Task
task2
=
new
Task
()
{
@Override
public
void
call
()
throws
Exception
{
public
void
call
()
{
while
(!
stop
)
{
int
i
=
counter
.
getAndIncrement
();
dataMap
.
put
(
i
,
i
*
10
);
...
...
@@ -247,7 +253,7 @@ public class TestConcurrent extends TestMVStore {
}
Task
task
=
new
Task
()
{
@Override
public
void
call
()
throws
Exception
{
public
void
call
()
{
int
i
=
0
;
while
(!
stop
)
{
map
.
put
(
i
%
100
,
i
%
100
);
...
...
@@ -281,7 +287,7 @@ public class TestConcurrent extends TestMVStore {
try
{
Task
task
=
new
Task
()
{
@Override
public
void
call
()
throws
Exception
{
public
void
call
()
{
while
(!
stop
)
{
s
.
compact
(
100
,
1024
*
1024
);
}
...
...
@@ -290,7 +296,7 @@ public class TestConcurrent extends TestMVStore {
task
.
execute
();
Task
task2
=
new
Task
()
{
@Override
public
void
call
()
throws
Exception
{
public
void
call
()
{
while
(!
stop
)
{
s
.
compact
(
100
,
1024
*
1024
);
}
...
...
@@ -323,7 +329,7 @@ public class TestConcurrent extends TestMVStore {
m
.
put
(
1
,
1
);
Task
task
=
new
Task
()
{
@Override
public
void
call
()
throws
Exception
{
public
void
call
()
{
while
(!
stop
)
{
m
.
put
(
1
,
1
);
s
.
commit
();
...
...
@@ -386,7 +392,7 @@ public class TestConcurrent extends TestMVStore {
final
AtomicInteger
counter
=
new
AtomicInteger
();
Task
task
=
new
Task
()
{
@Override
public
void
call
()
throws
Exception
{
public
void
call
()
{
while
(!
stop
)
{
int
x
=
counter
.
getAndIncrement
();
if
(
x
>=
count
)
{
...
...
@@ -451,7 +457,7 @@ public class TestConcurrent extends TestMVStore {
final
AtomicInteger
counter
=
new
AtomicInteger
();
Task
task
=
new
Task
()
{
@Override
public
void
call
()
throws
Exception
{
public
void
call
()
{
while
(!
stop
)
{
counter
.
incrementAndGet
();
s
.
commit
();
...
...
@@ -483,7 +489,7 @@ public class TestConcurrent extends TestMVStore {
final
AtomicInteger
counter
=
new
AtomicInteger
();
Task
task
=
new
Task
()
{
@Override
public
void
call
()
throws
Exception
{
public
void
call
()
{
while
(!
stop
)
{
s
.
setStoreVersion
(
counter
.
incrementAndGet
());
s
.
commit
();
...
...
@@ -499,7 +505,7 @@ public class TestConcurrent extends TestMVStore {
// sometimes closing works, in which case
// storing must fail at some point (not necessarily
// immediately)
for
(
int
x
=
counter
.
get
(),
y
=
x
;
x
<=
y
+
2
;
x
++)
{
for
(
int
x
=
counter
.
get
(),
y
=
x
+
2
;
x
<=
y
;
x
++)
{
Thread
.
sleep
(
1
);
}
Exception
e
=
task
.
getException
();
...
...
@@ -529,7 +535,7 @@ public class TestConcurrent extends TestMVStore {
final
Random
rand
=
new
Random
(
1
);
Task
task
=
new
Task
()
{
@Override
public
void
call
()
throws
Exception
{
public
void
call
()
{
try
{
while
(!
stop
)
{
if
(
rand
.
nextBoolean
())
{
...
...
@@ -651,7 +657,7 @@ public class TestConcurrent extends TestMVStore {
final
Random
r
=
new
Random
();
Task
task
=
new
Task
()
{
@Override
public
void
call
()
throws
Exception
{
public
void
call
()
{
while
(!
stop
)
{
int
x
=
r
.
nextInt
(
len
);
if
(
r
.
nextBoolean
())
{
...
...
@@ -704,7 +710,7 @@ public class TestConcurrent extends TestMVStore {
final
Random
rand
=
new
Random
(
1
);
Task
task
=
new
Task
()
{
@Override
public
void
call
()
throws
Exception
{
public
void
call
()
{
while
(!
stop
)
{
try
{
if
(
rand
.
nextBoolean
())
{
...
...
@@ -715,13 +721,7 @@ public class TestConcurrent extends TestMVStore {
m
.
get
(
rand
.
nextInt
(
size
));
}
catch
(
ConcurrentModificationException
e
)
{
detected
.
incrementAndGet
();
}
catch
(
NegativeArraySizeException
e
)
{
notDetected
.
incrementAndGet
();
}
catch
(
ArrayIndexOutOfBoundsException
e
)
{
notDetected
.
incrementAndGet
();
}
catch
(
IllegalArgumentException
e
)
{
notDetected
.
incrementAndGet
();
}
catch
(
NullPointerException
e
)
{
}
catch
(
NegativeArraySizeException
|
ArrayIndexOutOfBoundsException
|
IllegalArgumentException
|
NullPointerException
e
)
{
notDetected
.
incrementAndGet
();
}
}
...
...
@@ -741,13 +741,7 @@ public class TestConcurrent extends TestMVStore {
m
.
get
(
rand
.
nextInt
(
size
));
}
catch
(
ConcurrentModificationException
e
)
{
detected
.
incrementAndGet
();
}
catch
(
NegativeArraySizeException
e
)
{
notDetected
.
incrementAndGet
();
}
catch
(
ArrayIndexOutOfBoundsException
e
)
{
notDetected
.
incrementAndGet
();
}
catch
(
IllegalArgumentException
e
)
{
notDetected
.
incrementAndGet
();
}
catch
(
NullPointerException
e
)
{
}
catch
(
NegativeArraySizeException
|
ArrayIndexOutOfBoundsException
|
IllegalArgumentException
|
NullPointerException
e
)
{
notDetected
.
incrementAndGet
();
}
}
...
...
@@ -771,7 +765,7 @@ public class TestConcurrent extends TestMVStore {
s
.
commit
();
Task
task
=
new
Task
()
{
@Override
public
void
call
()
throws
Exception
{
public
void
call
()
{
while
(!
stop
)
{
long
v
=
s
.
getCurrentVersion
()
-
1
;
Map
<
Integer
,
Integer
>
old
=
m
.
openVersion
(
v
);
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论