Java執行緒生命週期圖
阿新 • • 發佈:2019-01-09
- synchronized(waiting to enter monitor)等待獲得鎖
- synchronized(enter monitor)獲得鎖
- wait( )
join( )
LockSupport.park( )- notyfy( )、notifyAll( )、interrupt( )且獲得鎖
子執行緒結束(對應join( ))
LockSupport.unpark( )- Thread.sleep(millis)
wait(long)
join(long)
LockSupport.parkNanos(nanos)
LockSupport.parkUntil(deadline)- Time Waiting結束
notify( )、notifyAll( )
子執行緒結束(對應join( ))
LockSupport.unpark( )
interrupt( )且獲得鎖- Time Waiting結束
notify( )、notifyAll( )
interrupt( )且等待獲得鎖- notify( )、notifyAll( )
interrupt( )且等待獲得鎖
Java執行緒狀態分析/執行緒狀態轉換圖參考:https://blog.csdn.net/shi2huang/article/details/80289155