ws-muse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Twiner (JIRA)" <>
Subject [jira] Commented: (MUSE-283) SimpleNotificationProducer.getSubscriptions() returns a not-syncronized collection
Date Sun, 30 Dec 2007 15:59:43 GMT


Chris Twiner commented on MUSE-283:

simple workaround is to add this code to a derived function. 

protected synchronized Collection getSubscriptions()
   return new ArrayList(
        super.getSubscriptions()    );

(or add the arraylist wrapper into a c+p of simplenotificationproducer).

as removed / added subscriptions during the publish won't affect the list.  Only issue is
that a removed subscription still recieves an event.  As this is always possible due to network
issues I don't see that as a big issue.  Its certainly much quicker to do this than to use
a Hashtable for example and receive a hit on all functions.

Note that this should still be thread safe as the same object monitor is used with the synchronized
function (i believe, but couldn't find anything to the contrary).

> SimpleNotificationProducer.getSubscriptions() returns a not-syncronized collection
> ----------------------------------------------------------------------------------
>                 Key: MUSE-283
>                 URL:
>             Project: Muse
>          Issue Type: Bug
>          Components: WSN NotificationProducer
>    Affects Versions: 2.2.0
>         Environment: os: unix on solaris 
>            Reporter: Asaf Zafran
>            Assignee: Dan Jemiolo
>            Priority: Critical
> we have extended the SimpleNotificationProducer.
> in the method 
> public void publish(QName topicName, Element[] content, EndpointReference consumer) throws
> we have called the method:
> Iterator i = getSubsriptions().iterator();
> and the line 
> has caused a ConcurrentModificationException.
> the stack trace is :
> java.util.ConcurrentModificationException
>       	at java.util.HashMap$HashIterator.nextEntry(
>       	at java.util.HashMap$
>       	at java.util.Collections$UnmodifiableCollection$
>       	at
>       	at
>       	at
>       	at
>       	at
>       	at
>       	at
>       	at
>       	at
>       	at
>       	at
>       	at
>       	at

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message