[jboss-jira] [JBoss JIRA] Commented: (JGRP-617) ConcurrentModificationException sending notifications in ReplicatedHashMap.

Robert Newson (JIRA) jira-events at lists.jboss.org
Tue Nov 6 18:25:44 EST 2007


    [ http://jira.jboss.com/jira/browse/JGRP-617?page=comments#action_12386287 ] 
            
Robert Newson commented on JGRP-617:
------------------------------------

A possible quick fix is to use CopyOnWriteArrayList instead of Vector? There's a general jgroups TODO to switch to newer collection classes...

> ConcurrentModificationException sending notifications in ReplicatedHashMap.
> ---------------------------------------------------------------------------
>
>                 Key: JGRP-617
>                 URL: http://jira.jboss.com/jira/browse/JGRP-617
>             Project: JGroups
>          Issue Type: Bug
>    Affects Versions: 2.6
>            Reporter: Robert Newson
>         Assigned To: Bela Ban
>             Fix For: 2.6
>
>
> ReplicatedHashMap does this at line 587;
>  for(Notification notif: notifs)
>    notif.contentsSet(map);
> which causes a ConcurrentModificationException if the 'notifs' list is being modified during the execution. This class should use an Iterator over the 'notifs' list instead. There are several places where this occurs but this is illustrative.
> 2007-11-06 15:47:07,948 ERROR [Multiplexer,udp,192.168.164.229:34526] log.GeronimoLog (GeronimoLog.java:108) - uncaught exception in Thread[Multiplexer,udp,192.168.164.229:34526,10,MultiplexerThreads] (thread group=org.jgroups.util.Util$1[name=JGroups,maxpri=10] )
> java.util.ConcurrentModificationException
>         at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
>         at java.util.AbstractList$Itr.next(AbstractList.java:343)
>         at org.jgroups.blocks.ReplicatedHashMap._putAll(ReplicatedHashMap.java:587)
>         at org.jgroups.blocks.ReplicatedHashMap.setState(ReplicatedHashMap.java:716)
>         at org.jgroups.blocks.MessageDispatcher$ProtocolAdapter.handleUpEvent(MessageDispatcher.java:645)
>         at org.jgroups.blocks.MessageDispatcher$ProtocolAdapter.up(MessageDispatcher.java:745)
>         at org.jgroups.JChannel.up(JChannel.java:1069)
>         at org.jgroups.mux.Multiplexer$Task.run(Multiplexer.java:1026)
>         at org.jgroups.mux.Multiplexer$ExecuteTask.run(Multiplexer.java:1050)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
>         at java.lang.Thread.run(Thread.java:619)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list