maseth maseth - 1 month ago 7
Java Question

await method of class Condition not throwing InterruptedException

I have strange issue with an await method of Condition class in Java SE 6.
The problem is that await method NOT always throws an exception while interrupting by another thread.

In documentation it is written that the IE is thrown when:

...
Some other thread interrupts the current thread, and interruption of thread suspension is supported
...

How to interpret this subsentense: "and interruption of thread suspension is supported"

It seams to be imposible to not throwing an exception.
Do you ever had similar problem ?

Answer

Its not impossible not to throw InterruptedException what if the object has received signal via signal or signalAll API, the spec says these two methods will wake up any threads which are waiting on this condition.

Comments