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
            
        
        
            Active
            
        
            Viewed 969 times
        
    -3
            
            
        - 
                    1check this - http://stackoverflow.com/questions/217113/deadlock-in-java – Grisha Weintraub Nov 01 '12 at 12:08
 
2 Answers
1
            
            
        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();
        Peter Lawrey
        
- 525,659
 - 79
 - 751
 - 1,130