[ 
https://issues.apache.org/jira/browse/CAMEL-9237?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-9237.
--------------------------------
    Resolution: Cannot Reproduce

> ConcurrentModificationException when adding/removing routes in multiple 
> threads
> -------------------------------------------------------------------------------
>
>                 Key: CAMEL-9237
>                 URL: https://issues.apache.org/jira/browse/CAMEL-9237
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core, tests
>    Affects Versions: 2.16.0
>            Reporter: Chris Ribble
>            Priority: Minor
>
> Dynamically adding or removing routes in multiple threads can cause a 
> ConcurrentModificationException. For example, in my project's tests, we 
> dynamically mock out a large number of routes. When we run these tests 
> serially it works fine, but in parallel we almost always see a 
> ConcurrentModificationException when DefaultCamelContext passes the 
> routeDefinitions list to RouteDefinitionHelper.validateUniqueIds
> I propose that we fix this by making routeDefinitions (in 
> DefaultCamelContext) a CopyOnWriteArrayList instead of an ArrayList. 
> Apparently this was already done for the lifecycleStrategies list, presumably 
> for the same reason.
> It's also curious that the accessors for this list are marked synchronized. 
> Since the references are final, there's no reason to use volatile instead, so 
> it seems like the synchronized here is pointless.
> I also think we should consider doing the same for restDefinitions, since 
> there is nothing preventing this list from being modified in multiple threads.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to