$: pgrep java $: jstack pid > ~/temp/log 得到的结果如下 Found one Java-level deadlock: ============================= "Thread-1": waiting to lock monitor 0x00007fed60004e28 (object 0x000000076d0951b0, a java.lang.Object), which is held by "Thread-0" "Thread-0": waiting to lock monitor 0x00007fed600062c8 (object 0x000000076d0951c0, a java.lang.Object), which is held by "Thread-1"
Java stack information for the threads listed above: =================================================== "Thread-1": at chapter01.DeadLock$2.run(DeadLock.java:31) - waiting to lock <0x000000076d0951b0> (a java.lang.Object) - locked <0x000000076d0951c0> (a java.lang.Object) at java.lang.Thread.run(Thread.java:745) "Thread-0": at chapter01.DeadLock$1.run(DeadLock.java:20) - waiting to lock <0x000000076d0951c0> (a java.lang.Object) - locked <0x000000076d0951b0> (a java.lang.Object) at java.lang.Thread.run(Thread.java:745)