I looked again at the EventListenerList and it is right that the EventListenerList is concurrency save but not thread save. I also looked at the JavaBeans-Specification and I saw that I was wrong, because it is left open wheter a modification is regarded during event-delivery. (I still think it's better).

However the specification has something to say about multi-threading: JavaBeans-Specification: "In order to reduce the risk of deadlocks, we strongly recommend that event sources should avoid holding their own internal locks when they call event listener methods. Specifically, as in the example code in Section 6.5.1, we recommend they should avoid using a synchronized method to fire an event instead merely use a synchronized block to locate the target
listeners and then call the event listeners from unsynchronized code.".


I don't see a way this could be done with EventListenerList.

Generally (if you do not regard modifications) this means using a normal Vector synchronizing addListener and removeListener and when firing synchronized clone it and than use the clone to call the listener-methods.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to