Life Cycle of a Thread in Java
2018-05-29 14:35:26 2 举报
Java中线程的生命周期、Life Cycle of a Thread in Java
作者其他创作
大纲/内容
Running
12. aThread.interrupt()(Exception)1. aObject.notify()/aObject.notifyAll()2. The Join Thread Complete Execution3. LockSupport.unpark4. aCondition.signal()/aCondition.signalAll()5. //aThread.resume()
1. Normal IO/Socket... Blocked2. LOSE LOCK3. InterruptibleChannel IO Blocked4. Selector Blocked
Blocked
Waiting
Time Elapsed123. aThread.interrupt()(Exception)2. aObject.notify()/aObject.notifyAll()3. The Join Thread Complete Execution4. LockSupport.unpark5. aCondition.signal()/aCondition.signalAll()
Timed Waiting
Terminated
Dispatch
Read To Run
1. aObject.wait()2. aThread.join()3. LockSupport.park4. aCondition.await()5. //aThread.suspend()(不释放锁)
Runnable
1. Thread.sleep(time)(不释放锁)2. aObject.wait(timeout)3. aThread.join(timeout)4. LockSupport.park×××5. aCondition.await×××
1. Complete/Close etc...2. GET LOCK3. aThread.interrupt()(Exception)4. aThread.interrupt()(No Exception)
New
aThread.start()
1. Return/Complete Execution2. Error/No Catch Exception3. JVM Terminated4. //aThread.stop()(不同步)
1. Dispatch2. Thread.yield()
0 条评论
下一页