Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
69289378
提交
69289378
authored
7月 04, 2014
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix formatting
上级
c399aa1c
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
11 行增加
和
11 行删除
+11
-11
Command.java
h2/src/main/org/h2/command/Command.java
+2
-2
CacheLongKeyLIRS.java
h2/src/main/org/h2/mvstore/cache/CacheLongKeyLIRS.java
+9
-9
没有找到文件。
h2/src/main/org/h2/command/Command.java
浏览文件 @
69289378
...
@@ -92,8 +92,8 @@ public abstract class Command implements CommandInterface {
...
@@ -92,8 +92,8 @@ public abstract class Command implements CommandInterface {
public
abstract
ResultInterface
queryMeta
();
public
abstract
ResultInterface
queryMeta
();
/**
/**
* Execute an updating statement (for example
an insert, a delete, or an update),
* Execute an updating statement (for example
insert, delete, or update), if
*
if
this is possible.
* this is possible.
*
*
* @return the update count
* @return the update count
* @throws DbException if the command is not an updating statement
* @throws DbException if the command is not an updating statement
...
...
h2/src/main/org/h2/mvstore/cache/CacheLongKeyLIRS.java
浏览文件 @
69289378
...
@@ -108,7 +108,7 @@ public class CacheLongKeyLIRS<V> {
...
@@ -108,7 +108,7 @@ public class CacheLongKeyLIRS<V> {
max
,
segmentLen
,
stackMoveDistance
);
max
,
segmentLen
,
stackMoveDistance
);
}
}
}
}
private
int
getSegmentLen
(
long
max
)
{
private
int
getSegmentLen
(
long
max
)
{
// calculate the size of the map array
// calculate the size of the map array
// assume a fill factor of at most 75%
// assume a fill factor of at most 75%
...
@@ -243,7 +243,7 @@ public class CacheLongKeyLIRS<V> {
...
@@ -243,7 +243,7 @@ public class CacheLongKeyLIRS<V> {
private
Segment
<
V
>
getSegment
(
int
hash
)
{
private
Segment
<
V
>
getSegment
(
int
hash
)
{
return
segments
[
getSegmentIndex
(
hash
)];
return
segments
[
getSegmentIndex
(
hash
)];
}
}
private
int
getSegmentIndex
(
int
hash
)
{
private
int
getSegmentIndex
(
int
hash
)
{
return
(
hash
>>>
segmentShift
)
&
segmentMask
;
return
(
hash
>>>
segmentShift
)
&
segmentMask
;
}
}
...
@@ -599,19 +599,19 @@ public class CacheLongKeyLIRS<V> {
...
@@ -599,19 +599,19 @@ public class CacheLongKeyLIRS<V> {
usedMemory
=
0
;
usedMemory
=
0
;
stackSize
=
queueSize
=
queue2Size
=
0
;
stackSize
=
queueSize
=
queue2Size
=
0
;
}
}
/**
/**
* Create a new, larger cache segment from an existing one.
* Create a new, larger cache segment from an existing one.
* The caller must synchronize on the old segment, to avoid
* The caller must synchronize on the old segment, to avoid
* concurrent modifications.
* concurrent modifications.
*
*
* @param old the old segment
* @param old the old segment
* @param resizeFactor the factor to use to calculate the number of hash
* @param resizeFactor the factor to use to calculate the number of hash
* table buckets (must be a power of 2)
* table buckets (must be a power of 2)
*/
*/
Segment
(
Segment
<
V
>
old
,
int
resizeFactor
)
{
Segment
(
Segment
<
V
>
old
,
int
resizeFactor
)
{
this
(
old
.
maxMemory
,
this
(
old
.
maxMemory
,
old
.
entries
.
length
*
resizeFactor
,
old
.
entries
.
length
*
resizeFactor
,
old
.
stackMoveDistance
);
old
.
stackMoveDistance
);
Entry
<
V
>
s
=
old
.
stack
.
stackPrev
;
Entry
<
V
>
s
=
old
.
stack
.
stackPrev
;
while
(
s
!=
old
.
stack
)
{
while
(
s
!=
old
.
stack
)
{
...
@@ -641,7 +641,7 @@ public class CacheLongKeyLIRS<V> {
...
@@ -641,7 +641,7 @@ public class CacheLongKeyLIRS<V> {
s
=
s
.
queuePrev
;
s
=
s
.
queuePrev
;
}
}
}
}
private
void
addToMap
(
Entry
<
V
>
e
)
{
private
void
addToMap
(
Entry
<
V
>
e
)
{
int
index
=
getHash
(
e
.
key
)
&
mask
;
int
index
=
getHash
(
e
.
key
)
&
mask
;
e
.
mapNext
=
entries
[
index
];
e
.
mapNext
=
entries
[
index
];
...
@@ -649,7 +649,7 @@ public class CacheLongKeyLIRS<V> {
...
@@ -649,7 +649,7 @@ public class CacheLongKeyLIRS<V> {
usedMemory
+=
e
.
memory
;
usedMemory
+=
e
.
memory
;
mapSize
++;
mapSize
++;
}
}
private
static
<
V
>
Entry
<
V
>
copy
(
Entry
<
V
>
old
)
{
private
static
<
V
>
Entry
<
V
>
copy
(
Entry
<
V
>
old
)
{
Entry
<
V
>
e
=
new
Entry
<
V
>();
Entry
<
V
>
e
=
new
Entry
<
V
>();
e
.
key
=
old
.
key
;
e
.
key
=
old
.
key
;
...
@@ -661,7 +661,7 @@ public class CacheLongKeyLIRS<V> {
...
@@ -661,7 +661,7 @@ public class CacheLongKeyLIRS<V> {
/**
/**
* Check whether the cache segment is full.
* Check whether the cache segment is full.
*
*
* @return true if it contains more entries than hash table buckets.
* @return true if it contains more entries than hash table buckets.
*/
*/
public
boolean
isFull
()
{
public
boolean
isFull
()
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论