<Swing Dev> Please review fix for 7177111 : Jcomponent.AccessibleJComponent.AddPropertyListeners adds exponential listeners

Pete Brunet peter.brunet at oracle.com
Thu Nov 8 21:51:19 UTC 2012


Hi Everyone, Please review the following fix planned for 7u12.  It will
also go into 8 under 7179482.

Problem:
When an AT (Assistive Technology) accesses a Java application with
several nested frames, too many property change listeners are added
resulting in a severe performance impact for an AT user.

The issue is due to the fact that there is an accessibleContainerHandler
field in both javax.swing.JComponent.AccessibleJComponent and its
superclass, java.awt.Container.AccessibleAWTContainer.  When an AT calls
JComponent.AccessibleJComponent.addPropertyChangeListener a handler is
new'd and assigned to its accessibleContainerHandler field and then the
same method in the superclass is called and it also new's and assigns a
handler to its accessibleContainerHandler field.  Since there are two
handlers, when a child component is later added there are two callbacks
and for each one the AT will call addPropertyChangeListener, each of
which will add two handlers.  For deeply nested trees the explosion of
events has a negative impact on performance, i.e. there are 2 handlers
added for the first level, 4 for the second level, 8 for the third
level, etc.

Solution:
Remove protected field
javax.swing.JComponent.AccessibleJComponent.accessibleContainerHandler. 
Instead, the protected field of the same name in
java.awt.Container.AWTAccessibleContainer will be used.

Webrev:  http://cr.openjdk.java.net/~ptbrunet/7177111/webrev.03/
Bug:
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7177111
    http://monaco.us.oracle.com/detail.jsf?cr=7177111
CCC:  http://ccc.us.oracle.com/7177111
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20121108/25d88862/attachment.html>


More information about the swing-dev mailing list