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.
The moose likes Swing / AWT / SWT and the fly likes Are Default Swing Models Thread-Safe? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Are Default Swing Models Thread-Safe?" Watch "Are Default Swing Models Thread-Safe?" New topic
Author

Are Default Swing Models Thread-Safe?

Josh Britton
Greenhorn

Joined: Nov 26, 2008
Posts: 24
I read in the Java Tutorial that "most Swing object methods are not 'thread safe.'" Does that include default Swing Models? In other words, if I am, er, 'in,' a non-EDT thread and I call a method that updates a model, do I need to wrap the call in EventQueue.invokeLater?

Thanks,

josh
Brian Cole
Author
Ranch Hand

Joined: Sep 20, 2005
Posts: 875
    
    1
Originally posted by Josh Britton:
I read in the Java Tutorial that "most Swing object methods are not 'thread safe.'" Does that include default Swing Models? In other words, if I am, er, 'in,' a non-EDT thread and I call a method that updates a model, do I need to wrap the call in EventQueue.invokeLater?



Most of the swing models are not thread safe. Were you to update a model on a non-EDT thread, the events would likely be fired on a non-EDT thread too, which can be bad.


bitguru blog
Josh Britton
Greenhorn

Joined: Nov 26, 2008
Posts: 24
Thanks.
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Are Default Swing Models Thread-Safe?
 
It's not a secret anymore!