线程状态

obj.wait();

"pool-1-thread-1" prio=6 tid=0x02bde400 nid=0x948 in Object.wait() [0x02f0f000]
   java.lang.Thread.State: WAITING (on object monitor)

-----------------
obj.wait(1000);

"pool-1-thread-1" prio=6 tid=0x02bbd400 nid=0x1c8 in Object.wait() [0x02f0f000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)

-----------------
synchronized (obj) // 如果阻塞了

"pool-1-thread-1" prio=6 tid=0x02bbd000 nid=0x820 waiting for monitor entry [0x02f0f000]
   java.lang.Thread.State: BLOCKED (on object monitor)

-----------------
Thread.sleep(1000);

"pool-1-thread-1" prio=6 tid=0x02bde400 nid=0x4bc waiting on condition [0x02f0f000]
   java.lang.Thread.State: TIMED_WAITING (sleeping)

-----------------
LockSupport.park();

"pool-1-thread-1" prio=6 tid=0x02bbd000 nid=0x74c waiting on condition [0x02f0f000]
   java.lang.Thread.State: WAITING (parking)

-----------------
LockSupport.parkNanos(TimeUnit.SECONDS.toNanos(10));

"main" prio=6 tid=0x000000000027b000 nid=0xc9c waiting on condition [0x000000000253f000]
   java.lang.Thread.State: TIMED_WAITING (parking)

你可能感兴趣的:(java,thread)