Package com.iizix.os

Class ThreadDeadlockDetector


  • public class ThreadDeadlockDetector
    extends java.lang.Object
    A Thread dead-lock detector.
    Author:
    Christopher Mindus
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and TypeMethodDescription
      static voidcheckForDeadlocks()
      Checks for deadlocks.
      static java.lang.management.ThreadMXBeangetThreadMXBean()
      Gets the ThreadMXBean instance.
      static booleanstartDeadlockCheck​(long interval)
      Starts the singleton timer to perform dead-lock checking, once only.
      static booleanstopDeadlockCheck()
      Stops the singleton timer to perform dead-lock checking, once only.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ThreadDeadlockDetector

        public ThreadDeadlockDetector()
    • Method Detail

      • getThreadMXBean

        public static java.lang.management.ThreadMXBean getThreadMXBean()
        Gets the ThreadMXBean instance.
      • startDeadlockCheck

        public static boolean startDeadlockCheck​(long interval)
        Starts the singleton timer to perform dead-lock checking, once only.
        Parameters:
        interval - In milliseconds.
        Returns:
        true for OK, false if already started.
      • stopDeadlockCheck

        public static boolean stopDeadlockCheck()
        Stops the singleton timer to perform dead-lock checking, once only.
        Returns:
        true for OK, false if already stopped or never started.
      • checkForDeadlocks

        public static void checkForDeadlocks()
        Checks for deadlocks. If a dead-lock is found, it is logged in the server.