Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
ba44962f
提交
ba44962f
authored
2月 27, 2015
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Formatting
上级
cdbb19b0
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
9 行增加
和
9 行删除
+9
-9
TestTransactionStore.java
h2/src/test/org/h2/test/store/TestTransactionStore.java
+1
-1
TestStringCache.java
h2/src/test/org/h2/test/unit/TestStringCache.java
+3
-3
CacheLIRS.java
h2/src/tools/org/h2/dev/cache/CacheLIRS.java
+5
-5
没有找到文件。
h2/src/test/org/h2/test/store/TestTransactionStore.java
浏览文件 @
ba44962f
...
@@ -60,7 +60,7 @@ public class TestTransactionStore extends TestBase {
...
@@ -60,7 +60,7 @@ public class TestTransactionStore extends TestBase {
testSingleConnection
();
testSingleConnection
();
testCompareWithPostgreSQL
();
testCompareWithPostgreSQL
();
}
}
private
void
testConcurrentAdd
()
{
private
void
testConcurrentAdd
()
{
MVStore
s
;
MVStore
s
;
s
=
MVStore
.
open
(
null
);
s
=
MVStore
.
open
(
null
);
...
...
h2/src/test/org/h2/test/unit/TestStringCache.java
浏览文件 @
ba44962f
...
@@ -36,7 +36,7 @@ public class TestStringCache extends TestBase {
...
@@ -36,7 +36,7 @@ public class TestStringCache extends TestBase {
TestBase
.
createCaller
().
init
().
test
();
TestBase
.
createCaller
().
init
().
test
();
new
TestStringCache
().
runBenchmark
();
new
TestStringCache
().
runBenchmark
();
}
}
@Override
@Override
public
void
test
()
throws
InterruptedException
{
public
void
test
()
throws
InterruptedException
{
testToUpperToLower
();
testToUpperToLower
();
...
@@ -49,7 +49,7 @@ public class TestStringCache extends TestBase {
...
@@ -49,7 +49,7 @@ public class TestStringCache extends TestBase {
testSingleThread
(
getSize
(
5000
,
20000
));
testSingleThread
(
getSize
(
5000
,
20000
));
testMultiThreads
();
testMultiThreads
();
}
}
private
void
testToUpperCache
()
{
private
void
testToUpperCache
()
{
Random
r
=
new
Random
();
Random
r
=
new
Random
();
String
[]
test
=
new
String
[
50
];
String
[]
test
=
new
String
[
50
];
...
@@ -83,7 +83,7 @@ public class TestStringCache extends TestBase {
...
@@ -83,7 +83,7 @@ public class TestStringCache extends TestBase {
System
.
out
.
println
(
"toUpperCase "
+
time
);
System
.
out
.
println
(
"toUpperCase "
+
time
);
assertEquals
(
0
,
testLen
);
assertEquals
(
0
,
testLen
);
}
}
private
void
testToUpperToLower
()
{
private
void
testToUpperToLower
()
{
Random
r
=
new
Random
();
Random
r
=
new
Random
();
for
(
int
i
=
0
;
i
<
1000
;
i
++)
{
for
(
int
i
=
0
;
i
<
1000
;
i
++)
{
...
...
h2/src/tools/org/h2/dev/cache/CacheLIRS.java
浏览文件 @
ba44962f
...
@@ -38,7 +38,7 @@ import java.util.Set;
...
@@ -38,7 +38,7 @@ import java.util.Set;
* of other entries have been moved to the front (8 per segment by default).
* of other entries have been moved to the front (8 per segment by default).
* Write access and moving entries to the top of the stack is synchronized per
* Write access and moving entries to the top of the stack is synchronized per
* segment.
* segment.
*
*
* @author Thomas Mueller
* @author Thomas Mueller
* @param <K> the key type
* @param <K> the key type
* @param <V> the value type
* @param <V> the value type
...
@@ -158,7 +158,7 @@ public class CacheLIRS<K, V> extends AbstractMap<K, V> {
...
@@ -158,7 +158,7 @@ public class CacheLIRS<K, V> extends AbstractMap<K, V> {
return
s
.
put
(
key
,
hash
,
value
,
memory
);
return
s
.
put
(
key
,
hash
,
value
,
memory
);
}
}
}
}
private
Segment
<
K
,
V
>
resizeIfNeeded
(
Segment
<
K
,
V
>
s
,
int
segmentIndex
)
{
private
Segment
<
K
,
V
>
resizeIfNeeded
(
Segment
<
K
,
V
>
s
,
int
segmentIndex
)
{
int
newLen
=
s
.
getNewMapLen
();
int
newLen
=
s
.
getNewMapLen
();
if
(
newLen
==
0
)
{
if
(
newLen
==
0
)
{
...
@@ -425,7 +425,7 @@ public class CacheLIRS<K, V> extends AbstractMap<K, V> {
...
@@ -425,7 +425,7 @@ public class CacheLIRS<K, V> extends AbstractMap<K, V> {
* @param <V> the value type
* @param <V> the value type
*/
*/
private
static
class
Segment
<
K
,
V
>
{
private
static
class
Segment
<
K
,
V
>
{
/**
/**
* The number of (hot, cold, and non-resident) entries in the map.
* The number of (hot, cold, and non-resident) entries in the map.
*/
*/
...
@@ -573,11 +573,11 @@ public class CacheLIRS<K, V> extends AbstractMap<K, V> {
...
@@ -573,11 +573,11 @@ public class CacheLIRS<K, V> extends AbstractMap<K, V> {
s
=
s
.
queuePrev
;
s
=
s
.
queuePrev
;
}
}
}
}
/**
/**
* Calculate the new number of hash table buckets if the internal map
* Calculate the new number of hash table buckets if the internal map
* should be re-sized.
* should be re-sized.
*
*
* @return 0 if no resizing is needed, or the new length
* @return 0 if no resizing is needed, or the new length
*/
*/
int
getNewMapLen
()
{
int
getNewMapLen
()
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论