publicenum State { /** * Thread state for a thread which has not yet started. */ NEW,
/** * Thread state for a runnable thread. A thread in the runnable * state is executing in the Java virtual machine but it may * be waiting for other resources from the operating system * such as processor. */ RUNNABLE,
/** * Thread state for a thread blocked waiting for a monitor lock. * A thread in the blocked state is waiting for a monitor lock * to enter a synchronized block/method or * reenter a synchronized block/method after calling * {@link Object#wait() Object.wait}. */ BLOCKED,
/** * Thread state for a waiting thread. * A thread is in the waiting state due to calling one of the * following methods: * <ul> * <li>{@link Object#wait() Object.wait} with no timeout</li> * <li>{@link #join() Thread.join} with no timeout</li> * <li>{@link LockSupport#park() LockSupport.park}</li> * </ul> * * <p>A thread in the waiting state is waiting for another thread to * perform a particular action. * * For example, a thread that has called <tt>Object.wait()</tt> * on an object is waiting for another thread to call * <tt>Object.notify()</tt> or <tt>Object.notifyAll()</tt> on * that object. A thread that has called <tt>Thread.join()</tt> * is waiting for a specified thread to terminate. */ WAITING,
/** * Thread state for a waiting thread with a specified waiting time. * A thread is in the timed waiting state due to calling one of * the following methods with a specified positive waiting time: * <ul> * <li>{@link #sleep Thread.sleep}</li> * <li>{@link Object#wait(long) Object.wait} with timeout</li> * <li>{@link #join(long) Thread.join} with timeout</li> * <li>{@link LockSupport#parkNanos LockSupport.parkNanos}</li> * <li>{@link LockSupport#parkUntil LockSupport.parkUntil}</li> * </ul> */ TIMED_WAITING,
/** * Thread state for a terminated thread. * The thread has completed execution. */ TERMINATED; }
"t2" #14 prio=5 os_prio=31 tid=0x0000000130090800 nid=0xa303 waiting for monitor entry [0x0000000172a82000] java.lang.Thread.State: BLOCKED (on object monitor) at com.joshua.Multilock_7.DeadLock.lambda$test$1(DeadLock.java:36) - waiting to lock <0x0000000716138e48> (a java.lang.Object) - locked <0x0000000716138e58> (a java.lang.Object) at com.joshua.Multilock_7.DeadLock$$Lambda$2/1567581361.run(Unknown Source) at java.lang.Thread.run(Thread.java:748)
"t1" #13 prio=5 os_prio=31 tid=0x00000001278d1800 nid=0xa403 waiting for monitor entry [0x0000000172876000] java.lang.Thread.State: BLOCKED (on object monitor) at com.joshua.Multilock_7.DeadLock.lambda$test$0(DeadLock.java:25) - waiting to lock <0x0000000716138e58> (a java.lang.Object) - locked <0x0000000716138e48> (a java.lang.Object) at com.joshua.Multilock_7.DeadLock$$Lambda$1/1915503092.run(Unknown Source) at java.lang.Thread.run(Thread.java:748)
"Finalizer" #3 daemon prio=8 os_prio=31 tid=0x0000000126019000 nid=0x2f03 in Object.wait() [0x00000001710da000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on <0x0000000715588ef0> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:144) - locked <0x0000000715588ef0> (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=0x000000011e017800 nid=0x4803 in Object.wait() [0x0000000170ece000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on <0x0000000715586c08> (a java.lang.ref.Reference$Lock) at java.lang.Object.wait(Object.java:502) at java.lang.ref.Reference.tryHandlePending(Reference.java:191) - locked <0x0000000715586c08> (a java.lang.ref.Reference$Lock) at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:153)
"VM Periodic Task Thread" os_prio=31 tid=0x0000000127020800 nid=0xa603 waiting on condition
JNI global references: 3089
Found one Java-level deadlock: ============================= "t2": waiting to lock monitor 0x0000000126014850 (object 0x0000000716138e48, a java.lang.Object), which is held by "t1" "t1": waiting to lock monitor 0x0000000126016480 (object 0x0000000716138e58, a java.lang.Object), which is held by "t2"
Java stack information for the threads listed above: =================================================== "t2": at com.joshua.Multilock_7.DeadLock.lambda$test$1(DeadLock.java:36) - waiting to lock <0x0000000716138e48> (a java.lang.Object) - locked <0x0000000716138e58> (a java.lang.Object) at com.joshua.Multilock_7.DeadLock$$Lambda$2/1567581361.run(Unknown Source) at java.lang.Thread.run(Thread.java:748) "t1": at com.joshua.Multilock_7.DeadLock.lambda$test$0(DeadLock.java:25) - waiting to lock <0x0000000716138e58> (a java.lang.Object) - locked <0x0000000716138e48> (a java.lang.Object) at com.joshua.Multilock_7.DeadLock$$Lambda$1/1915503092.run(Unknown Source) at java.lang.Thread.run(Thread.java:748)