Java线程生命周期图

Java线程生命周期图_第1张图片

  1. synchronized(waiting to enter monitor)等待获得锁
  2. synchronized(enter monitor)获得锁
  3. wait( )
    join( )
    LockSupport.park( )
  4. notyfy( )、notifyAll( )、interrupt( )且获得锁
    子线程结束(对应join( ))
    LockSupport.unpark( )
  5. Thread.sleep(millis)
    wait(long)
    join(long)
    LockSupport.parkNanos(nanos)
    LockSupport.parkUntil(deadline)
  6. Time Waiting结束
    notify( )、notifyAll( )
    子线程结束(对应join( ))
    LockSupport.unpark( )
    interrupt( )且获得锁
  7. Time Waiting结束
    notify( )、notifyAll( )
    interrupt( )且等待获得锁
  8. notify( )、notifyAll( )
    interrupt( )且等待获得锁

Java线程状态分析/线程状态转换图参考:https://blog.csdn.net/shi2huang/article/details/80289155

你可能感兴趣的:(深度好文)