There seems to be a discrepancy between SO consensus and nearly every Java thread state diagram on the Internet; specifically, regarding thread state transition from WAITING
after notify()
or notifyAll()
is invoked...
- WAITING never goes directly to RUNNABLE
- The thread is WAITING until it is notified...Then it becomes BLOCKED...
- Once this thread is notified, it will not be runnable...This is..Blocked State.
So the concensus on SO is: a thread transitions from WAITING
to BLOCKED
after invoking notify()
or notifyAll()
; diagram below illustrates this transition in green.
Question
Why do most state diagrams on the web illustrate the transition from WAITING
to RUNNABLE
, not BLOCKED
? Depiction in red shows the incorrect transition; am I missing something?
TIMED_WAIT
? why it is directly going back toRUNNABLE
, instead of moving toBLOCKED
? – Tonguelash