[concurrency-interest] Confused about Component.getTreeLock()

Thomas Hawtin tackline at tackline.plus.com
Tue Mar 6 07:41:04 EST 2007

Peter Kovacs wrote:
>>From samples found on the Internet I can see that the
> Component.getTreeLock() method is mainly used in custom layout
> managers. Doesn't the assumption implied by the use of this lock go
> against the general rule that Java graphical components should not be
> manipulated from a thread other than the AWT Event Handler? In other
> words: why are layout management functions likelier to be executed in
> a custom thread -- a situation where locking is required at all --
> than are other kinds of GUI functions?

Swing is single threaded, AWT is not. However, AWT has thousands 
(literally) of threading bugs, which are unlikely to be fixed. It is 
unreasonable to expect multithreaded AWT application code not to be 
completely broken.

Tom Hawtin

More information about the Concurrency-interest mailing list