Package org.h2.util

Class ThreadDeadlockDetector

java.lang.Object
org.h2.util.ThreadDeadlockDetector

public class ThreadDeadlockDetector extends Object
Detects deadlocks between threads. Prints out data in the same format as the CTRL-BREAK handler, but includes information about table locks.
  • Field Details

  • 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

      public static void dumpAllThreadsAndLocks(String msg)
      Dump all deadlocks (if any).
      Parameters:
      msg - the message
    • dumpAllThreadsAndLocks

      public static void dumpAllThreadsAndLocks(String msg, PrintStream out)
      Dump all deadlocks (if any).
      Parameters:
      msg - the message
      out - the output
    • dumpThreadsAndLocks

      private static void dumpThreadsAndLocks(String msg, ThreadMXBean threadBean, long[] threadIds, PrintStream out)
    • printThreadInfo

      private static void printThreadInfo(PrintWriter print, ThreadInfo ti)
    • printThread

      private static void printThread(PrintWriter print, ThreadInfo ti)
    • printLockInfo

      private static void printLockInfo(PrintWriter print, LockInfo[] locks, String tableWaitingForLock, ArrayList<String> tableExclusiveLocks, ArrayList<String> tableSharedLocksMap)