[concurrency-interest] Swing translates InterruptedException to Error

Thomas Hawtin tackline at tackline.plus.com
Tue Dec 18 13:03:12 EST 2007


Gregg Wonderly wrote:
> Darius Polonis wrote:
>> Allright, in that case I'll just wrap my code and use  
>> SwingUtilities.invokeLater(). But I am not sure the Swing folks have  
>> to come to your conclusion, too, as the javadoc still states  
>> AbstractDocument.insertString() would be thread safe...
> 
> They used to say that an unrealized component could be manipulated outside of 
> the event thread.  This is now, no longer possible.  It is important to write 
> any code that touches a swing component to use the event dispatch thread.

A number of methods explicitly state that they are thread-safe. For 
instance, JTextArea.append. But given the interface of Document or even 
AbstractDocument, how would you write such a thing correctly?

Tom Hawtin


More information about the Concurrency-interest mailing list