-
1. Re: Problem with NotificationBroadcasterSupport?
juha Apr 30, 2002 7:07 PM (in response to davidjencks)clone the list
-- Juha -
2. Re: Problem with NotificationBroadcasterSupport?
juha Apr 30, 2002 7:09 PM (in response to davidjencks)well actually that sucks...
you gonna clone every time you send a notification?
poopoo
add/remove listeners on a copy, and make that the current active list once you're done iterating the list of listeners.
-- Juha -
3. Re: Problem with NotificationBroadcasterSupport?
davidjencks Apr 30, 2002 7:48 PM (in response to davidjencks)That would be ok if sendNotification was synchronized. Otherwise the semantics seem a little vague... in fact even the
Iterator listenerIterator = new ArrayList(listenerMap.keySet()).iterator();
solution should be synchronized on listenerMap as should the add/remove listener methods.
(doesn't look like Set extends Cloneable).
Are you OK with all this synchronization? If not I will write something in my class. I don't want to write the add/remove modifies copy right now. -
4. Re: Problem with NotificationBroadcasterSupport?
juha May 1, 2002 9:35 AM (in response to davidjencks)yea go ahead
either that or use OSWEGO, the iterators never throw CME (but you need to explicitly deal with null values)