Details
-
Type:
Bug
-
Status: Resolved
-
Priority:
P4
-
Resolution: Fixed
-
Affects Version/s: 1.4.2, 9, 10
-
Fix Version/s: 10
-
Component/s: client-libs
-
Labels:
-
Subcomponent:
-
Resolved In Build:b34
-
CPU:x86
-
OS:windows_2000
Description
Name: jl125535 Date: 04/14/2004
FULL PRODUCT VERSION :
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)
A DESCRIPTION OF THE REQUEST :
EventListenerList should synchronize getListeners() and getListenerList() methods to complement the synchronized add() and remove() methods.
I suggest EventListenerList be reimplemented using AWTEventMulticaster which is thread safe.
JUSTIFICATION :
Not synchronizing getListeners() and getListenerList() undoes the benefit of synchronizing the add and remove methods, because removing a listener while processing getListeners() can result in ArrayOutOfBoundsExceptions.
Also the re-assignment of the listener list at the bottom of the add and remove is not atomic so using the return of getListenerList() is problematic in a multi-threaded application.
This means for example you cannot reliably remove a Document listener using a program thread, while the document is being updated by the user on the Swing thread.
(Incident Review ID: 246793)
======================================================================
Attachments
Issue Links
- csr for
-
JDK-8191167 Increase thread safety of EventListenerList
-
- Closed
-