• Post Reply Bookmark Topic Watch Topic
  • New Topic

EventQueue Dispatching

 
sai thilak
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a problem in my code wherein I have multiple threads which are being dispatched using eventQueue's invokeLater() method. The problem occurs when one of the threads stalls for some reason in this queue, the subsequent threads do not get executed (or dispatched) from the eventQueue. I would like to ensure that ALL events are dispatched always.

Could someone please help me on this? This is urgent and I need to get this code out in a few days...

Thanks and Regards,
SaiThilak
 
Kaydell Leavitt
Ranch Hand
Posts: 690
Eclipse IDE Firefox Browser Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a problem in my code wherein I have multiple threads which are being dispatched using eventQueue's invokeLater() method.


The java.awt.EventQueue.invokeLater() method does not create new threads. It does not call start(), it calls run() directly so no new threads are created.

The problem occurs when one of the threads stalls for some reason in this queue, the subsequent threads do not get executed (or dispatched) from the eventQueue. I would like to ensure that ALL events are dispatched always


Since AWT & Swing are not thread-safe, all of the event-dispatch stuff runs on a single-thread. If while calling run() for one Runnable, the run() method does not complete, the rest of the events in the EventQueue will not be processed.

If you want to start a new thread, you would have to create a Thread object and call start() yourself instead of calling invokeLater() or invokeAndWait(). Though, you have to remember that all of your UI and event processing would have to be done by invokeLater() & invokeAndWait().

Kaydell
[ June 19, 2007: Message edited by: Kaydell Leavitt ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!