<AWT Dev> Endless loop in EventDispatchThread - proposed solution

David Holmes David.Holmes at oracle.com
Thu Aug 25 18:20:36 PDT 2011

On 26/08/2011 8:58 AM, Clemens Eisserer wrote:
> Hi,
>     Yes I understand why you added the check. I'm not sure what you mean
>     about hiding the InterruptedException though. As I understood the
>     scenario the interrupt() breaks the thread out of await() by throwing
>     IE, which is then caught at a higher-level (not sure exactly where), but
>     because of further pending events the IE does not cause the EDT to
>     detach/terminate but instead it continues to process events eventually
>     calling await() again. Then the stop() gets issued which causes the
>     await() to abort by throwing ThreadDeath, without reclaiming the Lock,
>     and so the unlock in the finally clause throws IllegalMonitorStateException.
> Sorry, misunderstanding on my side. I thought when interrupting the thread,
> re-claiming the lock would also fail, but it doesn't. Your analysis is
> totally correct. So the "full" patch could probably do without the checks,
> as it should not run into this condition (even when a ThreadDeath is covered
> by IllegalMonitorException, shutodown=true -> no more calls of await()).
> However, it doesn't hurt a lot on the other side. What do you think?

As long as it is clearly documented as to why the check is there


>     I'm no AWT expert either, it just concerns me when there is an
>     introduced change in behaviour without a full understanding of the
>     implications. We really need some input from an AWT event processing guru.
> Absolutly.
> Thanks again, Clemens

More information about the awt-dev mailing list