hsfxuebaodeMacBook-Pro:java-study hsfxuebao$ jps
51761 Jps
51721 DeadLockDemo
366
hsfxuebaodeMacBook-Pro:java-study hsfxuebao$ jstack 51721
2020-04-12 09:35:39
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.181-b13 mixed mode):
"Attach Listener" #13 daemon prio=9 os_prio=31 tid=0x00007fe6fb006800 nid=0x4303 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"DestroyJavaVM" #12 prio=5 os_prio=31 tid=0x00007fe6fc048800 nid=0x1903 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"Thread-1" #11 prio=5 os_prio=31 tid=0x00007fe6fc8ac800 nid=0x4503 waiting for monitor entry [0x0000700011178000]
java.lang.Thread.State: BLOCKED (on object monitor)
at concurrent.DeadLockDemo$2.run(DeadLockDemo.java:42)
- waiting to lock <0x0000000795796fd8> (a java.lang.String)
- locked <0x0000000795797008> (a java.lang.String)
at java.lang.Thread.run(Thread.java:748)
"Thread-0" #10 prio=5 os_prio=31 tid=0x00007fe6fc8ab800 nid=0x3f03 waiting for monitor entry [0x0000700011075000]
java.lang.Thread.State: BLOCKED (on object monitor)
at concurrent.DeadLockDemo$1.run(DeadLockDemo.java:31)
- waiting to lock <0x0000000795797008> (a java.lang.String)
- locked <0x0000000795796fd8> (a java.lang.String)
at java.lang.Thread.run(Thread.java:748)
"Service Thread" #9 daemon prio=9 os_prio=31 tid=0x00007fe6fb881800 nid=0x3c03 runnable [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C1 CompilerThread2" #8 daemon prio=9 os_prio=31 tid=0x00007fe6fc8a0000 nid=0x4803 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread1" #7 daemon prio=9 os_prio=31 tid=0x00007fe6fc89f000 nid=0x4903 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread0" #6 daemon prio=9 os_prio=31 tid=0x00007fe6fb886800 nid=0x3803 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"Monitor Ctrl-Break" #5 daemon prio=5 os_prio=31 tid=0x00007fe6fb878000 nid=0x3603 runnable [0x0000700010a63000]
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:171)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
- locked <0x000000079570a880> (a java.io.InputStreamReader)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at java.io.BufferedReader.fill(BufferedReader.java:161)
at java.io.BufferedReader.readLine(BufferedReader.java:324)
- locked <0x000000079570a880> (a java.io.InputStreamReader)
at java.io.BufferedReader.readLine(BufferedReader.java:389)
at com.intellij.rt.execution.application.AppMainV2$1.run(AppMainV2.java:64)
"Signal Dispatcher" #4 daemon prio=9 os_prio=31 tid=0x00007fe6fc80a800 nid=0x3403 runnable [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"Finalizer" #3 daemon prio=8 os_prio=31 tid=0x00007fe6fb803800 nid=0x2d03 in Object.wait() [0x000070001085d000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x0000000795588ed0> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:144)
- locked <0x0000000795588ed0> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:165)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:216)
"Reference Handler" #2 daemon prio=10 os_prio=31 tid=0x00007fe6fb007800 nid=0x2c03 in Object.wait() [0x000070001075a000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x0000000795586bf8> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Object.java:502)
at java.lang.ref.Reference.tryHandlePending(Reference.java:191)
- locked <0x0000000795586bf8> (a java.lang.ref.Reference$Lock)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:153)
"VM Thread" os_prio=31 tid=0x00007fe6fb81f000 nid=0x5103 runnable
"GC task thread#0 (ParallelGC)" os_prio=31 tid=0x00007fe6fc004000 nid=0x2007 runnable
"GC task thread#1 (ParallelGC)" os_prio=31 tid=0x00007fe6fb804800 nid=0x1e03 runnable
"GC task thread#2 (ParallelGC)" os_prio=31 tid=0x00007fe6fb805000 nid=0x5403 runnable
"GC task thread#3 (ParallelGC)" os_prio=31 tid=0x00007fe6fb805800 nid=0x5303 runnable
"VM Periodic Task Thread" os_prio=31 tid=0x00007fe6fb0ac000 nid=0x3d03 waiting on condition
JNI global references: 15
Found one Java-level deadlock:
=============================
"Thread-1":
waiting to lock monitor 0x00007fe6fb02dd58 (object 0x0000000795796fd8, a java.lang.String),
which is held by "Thread-0"
"Thread-0":
waiting to lock monitor 0x00007fe6fb02b418 (object 0x0000000795797008, a java.lang.String),
which is held by "Thread-1"
Java stack information for the threads listed above:
===================================================
"Thread-1":
at concurrent.DeadLockDemo$2.run(DeadLockDemo.java:42)
- waiting to lock <0x0000000795796fd8> (a java.lang.String)
- locked <0x0000000795797008> (a java.lang.String)
at java.lang.Thread.run(Thread.java:748)
"Thread-0":
at concurrent.DeadLockDemo$1.run(DeadLockDemo.java:31)
- waiting to lock <0x0000000795797008> (a java.lang.String)
- locked <0x0000000795796fd8> (a java.lang.String)
at java.lang.Thread.run(Thread.java:748)
Found 1 deadlock.