Java线程生命周期图

在这里插入图片描述

  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

猜你喜欢

转载自blog.csdn.net/qq_22771739/article/details/86093266