United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6784816 Remove AWT tree lock from Container methods: getComponent, getComponents, getComponentCount
JDK-6784816 : Remove AWT tree lock from Container methods: getComponent, getComponents, getComponentCount

Details
Type:
Bug
Submit Date:
2008-12-12
Status:
Closed
Updated Date:
2011-05-18
Project Name:
JDK
Resolved Date:
2011-05-18
Component:
client-libs
OS:
generic,solaris_nevada
Sub-Component:
java.awt
CPU:
sparc,generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
6u10
Fixed Versions:

Related Reports
Backport:
Relates:

Sub Tasks

Description
The fix for 6616323 adds synchronization on AWT tree lock to several methods in Container class (probably, in Component as well). AWT tree lock is a public lock that should be used for any hiearchy or layout operations *by developers*, not by AWT. That's why internal synchronization must be removed, and a warning about calling these methods without tree lock should be added.

                                    

Comments
EVALUATION

Shouldn't take the tree lock when doing some operations w/ children.
                                     
2008-12-29
EVALUATION

Historically, we didn't get AWT tree lock in these three methods:
    - Container.getComponent(index)
    - Container.getComponents()
    - Container.countComponents()
There are some applications (like Oracle Forms based), that rely on this behavior and face deadlocks after the fix for 6616323. Technically, these applications are incorrect, as JavaDoc for AWT tree lock explicitly says it should be used for component-tree and layout operations, so AWT expects these methods should be synchronized by developers.

The fix for this bug is to revert the old (pre-6u10) behavior and remove newly added synchronization from the methods mentioned above. Still, all the applications that call them without AWT tree lock must realize that they do this on their own risk. For example, due to some timings changes, the methods may return incorrect values without proper synchronization under AWT tree lock.
                                     
2009-01-13



Hardware and Software, Engineered to Work Together