Found one Java-level deadlock: ============================= "T1": waiting to lock monitor 0x00007f3794008200 (object 0x000000062ca6cfe8, a java.lang.String), which is held by "T2" "T2": waiting to lock monitor 0x00007f3794007f00 (object 0x000000062ca6cfa0, a java.lang.String), which is held by "T1"
Java stack information for the threads listed above: =================================================== "T1": at com.java.interview.lock.HoldLockThread.run(DeadLockDemo.java:28) - waiting to lock <0x000000062ca6cfe8> (a java.lang.String) - locked <0x000000062ca6cfa0> (a java.lang.String) at java.lang.Thread.run(java.base@11.0.9/Thread.java:834) "T2": at com.java.interview.lock.HoldLockThread.run(DeadLockDemo.java:28) - waiting to lock <0x000000062ca6cfa0> (a java.lang.String) - locked <0x000000062ca6cfe8> (a java.lang.String) at java.lang.Thread.run(java.base@11.0.9/Thread.java:834)
Found 1 deadlock.
通过查看最后一行的堆栈信息,可以看到 Found 1 deadlock,即表示 Java 应用程序存在一个死锁