java线程运行过程中的各个状态的转换如下图:
实例化后New
New-->RUNNABLE
Thread.start() ==>系统调度
running—>ready <==Thread.yield
ready-->running
RUNNABLE-->WAITING Object.wait() Thread.join() LockSupport.park()
RUNNABLE-->TIME_WAITING Object.wait(long) Thread.sleep(long) Thread.join(long) LockSupport.parkNanos() LockSupport.parkUntil()
RUNNABLE-->BLOCKED 等待进入synchronized方法 等待进入synchronized块
RUNNABLE-->TERMINATED
WAITING-->RUNNABLE Object.notify() Object.notifyAll() LockSupport.unpark(Thread)
TIME_WAITING-->RUNNABLE Object.notify() Object.notifyAll() LockSupport.unpark(Thread)
BLOCK-->RUNNABLE