JDK-6784816 : Remove AWT tree lock from Container methods: getComponent, getComponents, getComponentCount
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6u10
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic,solaris_nevada
  • CPU: generic,sparc
  • Submitted: 2008-12-12
  • Updated: 2017-05-16
  • Resolved: 2011-05-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
JDK 6 JDK 7
6u12Fixed 7 b55Fixed
Related Reports
Relates :  
Relates :  
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 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

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