Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
c6ce63d8
提交
c6ce63d8
authored
7月 22, 2015
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Formatting (spaces instead of tabs and so on)
上级
94312cca
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
182 行增加
和
181 行删除
+182
-181
Engine.java
h2/src/main/org/h2/engine/Engine.java
+1
-1
JdbcResultSet.java
h2/src/main/org/h2/jdbc/JdbcResultSet.java
+4
-4
MVTable.java
h2/src/main/org/h2/mvstore/db/MVTable.java
+6
-6
Schema.java
h2/src/main/org/h2/schema/Schema.java
+2
-4
Sequence.java
h2/src/main/org/h2/schema/Sequence.java
+38
-38
Column.java
h2/src/main/org/h2/table/Column.java
+5
-5
ThreadDeadlockDetector.java
h2/src/main/org/h2/util/ThreadDeadlockDetector.java
+126
-123
没有找到文件。
h2/src/main/org/h2/engine/Engine.java
浏览文件 @
c6ce63d8
h2/src/main/org/h2/jdbc/JdbcResultSet.java
浏览文件 @
c6ce63d8
h2/src/main/org/h2/mvstore/db/MVTable.java
浏览文件 @
c6ce63d8
...
@@ -49,6 +49,10 @@ import org.h2.value.Value;
...
@@ -49,6 +49,10 @@ import org.h2.value.Value;
*/
*/
public
class
MVTable
extends
TableBase
{
public
class
MVTable
extends
TableBase
{
public
static
final
DebuggingThreadLocal
<
String
>
WAITING_FOR_LOCK
=
new
DebuggingThreadLocal
<
String
>();
public
static
final
DebuggingThreadLocal
<
ArrayList
<
String
>>
EXCLUSIVE_LOCKS
=
new
DebuggingThreadLocal
<
ArrayList
<
String
>>();
public
static
final
DebuggingThreadLocal
<
ArrayList
<
String
>>
SHARED_LOCKS
=
new
DebuggingThreadLocal
<
ArrayList
<
String
>>();
private
MVPrimaryIndex
primaryIndex
;
private
MVPrimaryIndex
primaryIndex
;
private
final
ArrayList
<
Index
>
indexes
=
New
.
arrayList
();
private
final
ArrayList
<
Index
>
indexes
=
New
.
arrayList
();
private
long
lastModificationId
;
private
long
lastModificationId
;
...
@@ -58,10 +62,6 @@ public class MVTable extends TableBase {
...
@@ -58,10 +62,6 @@ public class MVTable extends TableBase {
private
final
ConcurrentHashMap
<
Session
,
Session
>
lockSharedSessions
=
private
final
ConcurrentHashMap
<
Session
,
Session
>
lockSharedSessions
=
new
ConcurrentHashMap
<
Session
,
Session
>();
new
ConcurrentHashMap
<
Session
,
Session
>();
public
static
final
DebuggingThreadLocal
<
String
>
WAITING_FOR_LOCK
=
new
DebuggingThreadLocal
<
String
>();
public
static
final
DebuggingThreadLocal
<
ArrayList
<
String
>>
EXCLUSIVE_LOCKS
=
new
DebuggingThreadLocal
<
ArrayList
<
String
>>();
public
static
final
DebuggingThreadLocal
<
ArrayList
<
String
>>
SHARED_LOCKS
=
new
DebuggingThreadLocal
<
ArrayList
<
String
>>();
/**
/**
* The queue of sessions waiting to lock the table. It is a FIFO queue to
* The queue of sessions waiting to lock the table. It is a FIFO queue to
* prevent starvation, since Java's synchronized locking is biased.
* prevent starvation, since Java's synchronized locking is biased.
...
...
h2/src/main/org/h2/schema/Schema.java
浏览文件 @
c6ce63d8
...
@@ -9,7 +9,6 @@ import java.util.ArrayList;
...
@@ -9,7 +9,6 @@ import java.util.ArrayList;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
org.h2.api.ErrorCode
;
import
org.h2.api.ErrorCode
;
import
org.h2.api.TableEngine
;
import
org.h2.command.ddl.CreateTableData
;
import
org.h2.command.ddl.CreateTableData
;
import
org.h2.constraint.Constraint
;
import
org.h2.constraint.Constraint
;
import
org.h2.engine.Database
;
import
org.h2.engine.Database
;
...
@@ -27,7 +26,6 @@ import org.h2.mvstore.db.MVTableEngine;
...
@@ -27,7 +26,6 @@ import org.h2.mvstore.db.MVTableEngine;
import
org.h2.table.RegularTable
;
import
org.h2.table.RegularTable
;
import
org.h2.table.Table
;
import
org.h2.table.Table
;
import
org.h2.table.TableLink
;
import
org.h2.table.TableLink
;
import
org.h2.util.JdbcUtils
;
import
org.h2.util.New
;
import
org.h2.util.New
;
/**
/**
...
...
h2/src/main/org/h2/schema/Sequence.java
浏览文件 @
c6ce63d8
...
@@ -248,7 +248,7 @@ public class Sequence extends SchemaObjectBase {
...
@@ -248,7 +248,7 @@ public class Sequence extends SchemaObjectBase {
boolean
needsFlush
=
false
;
boolean
needsFlush
=
false
;
long
retVal
;
long
retVal
;
long
flushValueWithMargin
=
-
1
;
long
flushValueWithMargin
=
-
1
;
synchronized
(
this
)
{
synchronized
(
this
)
{
if
((
increment
>
0
&&
value
>=
valueWithMargin
)
||
if
((
increment
>
0
&&
value
>=
valueWithMargin
)
||
(
increment
<
0
&&
value
<=
valueWithMargin
))
{
(
increment
<
0
&&
value
<=
valueWithMargin
))
{
valueWithMargin
+=
increment
*
cacheSize
;
valueWithMargin
+=
increment
*
cacheSize
;
...
...
h2/src/main/org/h2/table/Column.java
浏览文件 @
c6ce63d8
h2/src/main/org/h2/util/ThreadDeadlockDetector.java
浏览文件 @
c6ce63d8
...
@@ -23,36 +23,39 @@ import org.h2.mvstore.db.MVTable;
...
@@ -23,36 +23,39 @@ import org.h2.mvstore.db.MVTable;
* Detects deadlocks between threads. Prints out data in the same format as the CTRL-BREAK handler,
* Detects deadlocks between threads. Prints out data in the same format as the CTRL-BREAK handler,
* but includes information about table locks.
* but includes information about table locks.
*/
*/
public
class
ThreadDeadlockDetector
public
class
ThreadDeadlockDetector
{
{
private
static
String
INDENT
=
" "
;
private
final
ThreadMXBean
tmbean
;
private
static
final
String
INDENT
=
" "
;
private
final
Timer
threadCheck
=
new
Timer
(
"ThreadDeadlockDetector"
,
true
/* isDaemon */
)
;
private
static
ThreadDeadlockDetector
detector
;
private
static
ThreadDeadlockDetector
detector
=
null
;
private
final
ThreadMXBean
tmbean
;
public
synchronized
static
void
init
()
{
// a daemon thread
if
(
detector
==
null
)
{
private
final
Timer
threadCheck
=
new
Timer
(
"ThreadDeadlockDetector"
,
true
);
detector
=
new
ThreadDeadlockDetector
();
}
}
private
ThreadDeadlockDetector
()
{
private
ThreadDeadlockDetector
()
{
this
.
tmbean
=
ManagementFactory
.
getThreadMXBean
();
this
.
tmbean
=
ManagementFactory
.
getThreadMXBean
();
// delay: 10 ms
// period: 10000 ms (100 seconds)
threadCheck
.
schedule
(
new
TimerTask
()
{
threadCheck
.
schedule
(
new
TimerTask
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
checkForDeadlocks
();
checkForDeadlocks
();
}
}
},
10
/*delay(ms)*/
,
10000
/*period(ms)*/
);
},
10
,
10000
);
}
public
static
synchronized
void
init
()
{
if
(
detector
==
null
)
{
detector
=
new
ThreadDeadlockDetector
();
}
}
}
/**
/**
* Checks if any threads are deadlocked. If any, print the thread dump information.
* Checks if any threads are deadlocked. If any, print the thread dump information.
*/
*/
private
void
checkForDeadlocks
()
{
void
checkForDeadlocks
()
{
long
[]
tids
=
tmbean
.
findDeadlockedThreads
();
long
[]
tids
=
tmbean
.
findDeadlockedThreads
();
if
(
tids
==
null
)
{
if
(
tids
==
null
)
{
return
;
return
;
...
@@ -63,11 +66,11 @@ public class ThreadDeadlockDetector
...
@@ -63,11 +66,11 @@ public class ThreadDeadlockDetector
print
.
println
(
"ThreadDeadlockDetector - deadlock found :"
);
print
.
println
(
"ThreadDeadlockDetector - deadlock found :"
);
final
ThreadInfo
[]
infos
=
tmbean
.
getThreadInfo
(
tids
,
true
,
true
);
final
ThreadInfo
[]
infos
=
tmbean
.
getThreadInfo
(
tids
,
true
,
true
);
final
HashMap
<
Long
,
String
>
mvtableWaitingForLockMap
=
final
HashMap
<
Long
,
String
>
mvtableWaitingForLockMap
=
MVTable
.
WAITING_FOR_LOCK
.
getSnapshotOfAllThreads
();
MVTable
.
WAITING_FOR_LOCK
.
getSnapshotOfAllThreads
();
final
HashMap
<
Long
,
ArrayList
<
String
>>
mvtableExclusiveLocksMap
=
final
HashMap
<
Long
,
ArrayList
<
String
>>
mvtableExclusiveLocksMap
=
MVTable
.
EXCLUSIVE_LOCKS
.
getSnapshotOfAllThreads
();
MVTable
.
EXCLUSIVE_LOCKS
.
getSnapshotOfAllThreads
();
final
HashMap
<
Long
,
ArrayList
<
String
>>
mvtableSharedLocksMap
=
final
HashMap
<
Long
,
ArrayList
<
String
>>
mvtableSharedLocksMap
=
MVTable
.
SHARED_LOCKS
.
getSnapshotOfAllThreads
();
MVTable
.
SHARED_LOCKS
.
getSnapshotOfAllThreads
();
for
(
ThreadInfo
ti
:
infos
)
{
for
(
ThreadInfo
ti
:
infos
)
{
printThreadInfo
(
print
,
ti
);
printThreadInfo
(
print
,
ti
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论