Class ThreadDeadlockDetector
java.lang.Object
org.h2.util.ThreadDeadlockDetector
Detects deadlocks between threads. Prints out data in the same format as the
CTRL-BREAK handler, but includes information about table locks.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static ThreadDeadlockDetectorprivate static final Stringprivate final ThreadMXBean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidChecks if any threads are deadlocked.static voidDump all deadlocks (if any).static voiddumpAllThreadsAndLocks(String msg, PrintStream out) Dump all deadlocks (if any).private static voiddumpThreadsAndLocks(String msg, ThreadMXBean threadBean, long[] threadIds, PrintStream out) static voidinit()Initialize the detector.private static voidprintLockInfo(PrintWriter print, LockInfo[] locks, String tableWaitingForLock, ArrayList<String> tableExclusiveLocks, ArrayList<String> tableSharedLocksMap) private static voidprintThread(PrintWriter print, ThreadInfo ti) private static voidprintThreadInfo(PrintWriter print, ThreadInfo ti)
-
Field Details
-
INDENT
- See Also:
-
detector
-
threadBean
-
-
Constructor Details
-
ThreadDeadlockDetector
private ThreadDeadlockDetector()
-
-
Method Details
-
init
public static void init()Initialize the detector. -
checkForDeadlocks
void checkForDeadlocks()Checks if any threads are deadlocked. If any, print the thread dump information. -
dumpAllThreadsAndLocks
Dump all deadlocks (if any).- Parameters:
msg- the message
-
dumpAllThreadsAndLocks
Dump all deadlocks (if any).- Parameters:
msg- the messageout- the output
-
dumpThreadsAndLocks
private static void dumpThreadsAndLocks(String msg, ThreadMXBean threadBean, long[] threadIds, PrintStream out) -
printThreadInfo
-
printThread
-
printLockInfo
-