Java - notifyAll() and notify() failed? Is it possible?
<p>This is really weird to me, but looks like notifyAll()/notify() failed in my program.
The code is rather complicated, basically I have three threads A, B, C</p>

<p>A sends request to B and wait() on the request with a 10 secs timeout, when B finishes, it calls notify() to wake up A.</p>

<p>C in a deadloop feeds a lot of strings to A through a queue, A picks up them and prints out. Each time A print out a string it sends a request to B and wait.</p>

<p>So the workflow comes to be:</p>

<p>C keeps feeding a in deadloop</p>

<ol>
<li>A prints out string from C</li>
<li>A sends request to B and wait(10)</li>
<li><p>B notify() A
......</p></li>
<li><p>A prints out string from C
.... again and again ....</p></li>
</ol>

<p>This works in first a few seconds. however, after a while I see when B prints out that it has notify() A, A is still waiting because the queue which C uses to feed A is getting increased quickly, and no string gets printed by A. Finally, after 10 secs, A complains the request timeout.</p>

<p>This looks like the notify() failed because B printed out message after it called notify(). Given wait/notify is radical feature of java, I can not believe it will fail. Is it possible?</p>
