This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
This is probably a really dumb question, but I'd appreciate any help: I'm just curious.
If I have an actionlistener which is executing its actionPerformed inside the AWT event dispatch thread (i.e. we haven't done the correct thing of either doing the work in a new thread so it doesn't hog the event dispatch thread, or doing the work in an invokeLater if it manipulates any Swing components), what happens to the peer events from the OS when this is running: do they get queued ready for dispatch when the actionPerformed returns?
As far as I can remember, events (and anything else) queue until the thread is available, but I am not sure. You will have to try it out with two actionListeners; that might verify it. Does the threading policy link help?
Joined: May 24, 2009
I just wrote this program and tested it by clicking Btn1 and then Btn2 lots of times. After the sleep had completed, the remaining events were pumped, then the program terminated. So they are indeed queued.
Joined: Oct 13, 2005
Well done You have verified queuing for a simple example, so presumably queuing is normal behaviour.