<AWT Dev> Endless loop in EventDispatchThread - proposed solution

Clemens Eisserer linuxhippy at gmail.com
Wed Aug 24 03:05:21 PDT 2011


Hi,

Please find the proposed fix at:
http://cr.openjdk.java.net/~ceisserer/7081670/

The "minimal" patch just tries to restore the behaviour when monitors were
used, trying to be low-risk.
The "full" patch does no longer rely on async exeptions (but still honors
them if they happen), and calls detachQueue unconditionally on shutdown (but
still takes care of pending events of only stopDispatch() has been called).

I didn't change AppContext.dispose(), as I think calling Thread.stop() may
be still benefitial to kill application-specific threads which don't honor
interrupt().

I took the liberty to do a small amount of low-risk refactoring:
- Replaced Vector with ArrayList, as it is only accessed after acquiring its
monitor
- Replaced event-queue id gerenation code with AtomicInteger
- Made waitForID volatile, as it is accessed by multiple threads.

Thanks, Clemens
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20110824/88a18425/attachment.html 


More information about the awt-dev mailing list