提交 90b7019c authored 作者: Noel Grandin's avatar Noel Grandin

fix for watchdog

上级 b49019f1
......@@ -16,6 +16,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Timer;
import java.util.TimerTask;
import org.h2.engine.SysProperties;
import org.h2.mvstore.db.MVTable;
/**
......@@ -73,19 +74,31 @@ public class ThreadDeadlockDetector {
dumpThreadsAndLocks(msg, threadBean, allThreadIds);
}
private static void dumpThreadsAndLocks(String msg, ThreadMXBean threadBean, long[] threadIds)
{
private static void dumpThreadsAndLocks(String msg, ThreadMXBean threadBean,
long[] threadIds) {
final StringWriter stringWriter = new StringWriter();
final PrintWriter print = new PrintWriter(stringWriter);
print.println(msg);
final ThreadInfo[] infos = threadBean.getThreadInfo(threadIds, true, true);
final HashMap<Long, String> tableWaitingForLockMap =
MVTable.WAITING_FOR_LOCK.getSnapshotOfAllThreads();
final HashMap<Long, ArrayList<String>> tableExclusiveLocksMap =
MVTable.EXCLUSIVE_LOCKS.getSnapshotOfAllThreads();
final HashMap<Long, ArrayList<String>> tableSharedLocksMap =
MVTable.SHARED_LOCKS.getSnapshotOfAllThreads();
final HashMap<Long, String> tableWaitingForLockMap;
final HashMap<Long, ArrayList<String>> tableExclusiveLocksMap;
final HashMap<Long, ArrayList<String>> tableSharedLocksMap;
if (SysProperties.THREAD_DEADLOCK_DETECTOR) {
tableWaitingForLockMap = MVTable.WAITING_FOR_LOCK
.getSnapshotOfAllThreads();
tableExclusiveLocksMap = MVTable.EXCLUSIVE_LOCKS
.getSnapshotOfAllThreads();
tableSharedLocksMap = MVTable.SHARED_LOCKS
.getSnapshotOfAllThreads();
} else {
tableWaitingForLockMap = New.hashMap();
tableExclusiveLocksMap = New.hashMap();
tableSharedLocksMap = New.hashMap();
}
final ThreadInfo[] infos = threadBean.getThreadInfo(threadIds, true,
true);
for (ThreadInfo ti : infos) {
printThreadInfo(print, ti);
printLockInfo(print, ti.getLockedSynchronizers(),
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论