title: Does Java monitor's wait set has a priority over entry set?
body: <p>I would like to ask you a question related to multithreading in Java.</p>
  
  <p>I have a monitor and multiple threads are eager to own it.
  Also inside the critical section <code>this.wait()</code> is invoked based on some conditions.</p>
  
  <p>AFAIK, the monitor has 2 sets of threads:</p>
  
  <ul>
  <li>entry set - where just arrived threads congregate and wait for their turn to own the monitor</li>
  <li>wait set - where <code>this.wait()</code> threads that are waiting to be awakened</li>
  </ul>
  
  <p>But how do they compete when <code>notify</code>/<code>notifyAll</code> is called?
  Do threads from wait set have a priority in acquiring the monitor over threads in entry set or do they move to entry set?</p>
  
  <p>Can I be sure that in case of <code>notify</code> the next executed thread will be one from the wait set?</p>