I have been trying to find whether JVM has some way to find if some threads are in deadlock condition. I am unable to find any. Please let me know if any one of you gets any pointer on this.
asked Nov 1, 2012 at 12:04
-
1check this - stackoverflow.com/questions/217113/deadlock-in-javaGrisha Weintraub– Grisha Weintraub2012年11月01日 12:08:46 +00:00Commented Nov 1, 2012 at 12:08
2 Answers 2
You can use the ThreadMXBean JMX bean.
ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
ThreadInfo[] threadInfos = threadMXBean.dumpAllThreads(true, true);
long[] deadlockedThreads = threadMXBean.findDeadlockedThreads();
long[] monitorDeadlockedThreads = threadMXBean.findMonitorDeadlockedThreads();
answered Nov 1, 2012 at 12:13
Sign up to request clarification or add additional context in comments.
Comments
No, the JVM itself does not support deadlock detection.
There is a thread that deals with JVM and deadlocks, which is also marked as resolved: Link
Comments
lang-java