Package com.iizix.os
Class ThreadDeadlockDetector
java.lang.Object
com.iizix.os.ThreadDeadlockDetector
A Thread dead-lock detector.
- Author:
- Christopher Mindus
Constructor Summary
Method Summary
Modifier and TypeMethodDescriptionstatic void
Checks for deadlocks.static ThreadMXBean
Gets the ThreadMXBean instance.static boolean
Starts the singleton timer to perform dead-lock checking every 60 seconds, once only.static boolean
startDeadlockCheck
(long interval) Starts the singleton timer to perform dead-lock checking, once only.static boolean
Stops the singleton timer to perform dead-lock checking, once only.
Constructor Details
ThreadDeadlockDetector
public ThreadDeadlockDetector()
Method Details
getThreadMXBean
Gets the ThreadMXBean instance.startDeadlockCheck
public static boolean startDeadlockCheck()Starts the singleton timer to perform dead-lock checking every 60 seconds, once only.- Returns:
- true for OK, false if already started.
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.