title: Thread interrupt: will it cancel oncoming wait() call?
body: <p>I have a thread which has an incoming job queue (a <code>LinkedList</code> containing job descriptions). The thread blocks with <code>wait()</code> on the queue when there's no job to work on. An external job dispatcher object awakes it with <code>notify()</code> when it places new jobs on the queue.</p>
  
  <p>At shutdown of my program i call <code>interrupt()</code> on the Thread. This raises <code>InterruptedException</code> when the Thread awaits for jobs in <code>wait()</code>. My question is: what will happen if i interrupt the Thread while it's not blocking but doing some kind of work, the processed item was the last in the queue (so queue is now empty) and execution pasts the <code>isInterrupted()</code> check before the interrupted flag is set so it calls <code>wait()</code> again? Will it throw an <code>InterruptedException</code> because the interrupted flag has already been set or the thread waits forever because new jobs will never arrive to the queue and there's no one to interrupt the wait?</p>