The monitor is a fundamental conception that you should understand. It is better to read about it somewhere.
In short, I could say that there are some major principles:
- If a thread go into the synchronized block - the monitor of synchronized object is blocked and all other threads couldn't
execute the synchronized block (they are in the Entry Set).
- If you call wait() method on synchronized object, then the thread go to Wait Set
- If you call notify()/notifyAll() method on synchronized object, it means that one/all thread(s) go to Entry Set from Wait Set.
The answer to your question is - when you call notifyAll() method, all threads from Wait Set go to Entry Set.