NEW
/**
* Thread state for a thread which has not yet started.
*/
線程已經(jīng)創(chuàng)建,但是還未啟動
RUNNABLE
/**
* 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.
*/
一個正在被執(zhí)行的線程的狀態(tài)
BLOCKED
/**
* 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}.
*/
一個線程因為等待臨界區(qū)(同步代碼塊或者同步方法,非java.util.concurrent庫中的鎖)的鎖被阻塞產(chǎn)生的狀態(tài),Lock 或者synchronize 關(guān)鍵字產(chǎn)生的狀態(tài)?;蛘咧剡M入臨界區(qū)的鎖當(dāng)調(diào)用wait之后
WAITTING
/**
* 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.
*/
一個線程進入了鎖,但是需要等待其他線程執(zhí)行某些操作。時間不確定,當(dāng)wait,join,park方法調(diào)以及等待Lock或Condition用時,進入waiting狀態(tài)。前提是這個線程已經(jīng)擁有鎖了。
TIMED_WAITTING
/**
* 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>
*/
一個線程進入了鎖,但是需要等待其他線程執(zhí)行某些操作。時間確定,通過sleep或wait timeout方法進入的限期等待的狀態(tài)
TERMINATED
/**
* Thread state for a terminated thread.
* The thread has completed execution.
*/
線程已經(jīng)終止