java deadlock detection - jstack

When a deadlock occurs in a java program, you can use jstack to view it:

1. Under windows, enter the cmd window, and then enter the bin directory of jdk:

cd C:\Program Files\Java\jdk1.7.0_67\bin


 

2. Execute the jps command:

jps


 

3. Execute the jstack command:

jstack -l 8372 // 8372 is the thread id where the deadlock occurred



 It can be seen that the two places where deadlock occurs are:

package2.deadLock.DeadThread.run(DeadThread.java:37)

package2.deadLock.DeadThread.run(DeadThread.java:24)

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326488867&siteId=291194637