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)