camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <>
Subject [jira] [Commented] (CAMEL-9237) ConcurrentModificationException when adding/removing routes in multiple threads
Date Wed, 21 Oct 2015 15:21:27 GMT


Claus Ibsen commented on CAMEL-9237:

Are you running a set of independent tests in parallel and for each test you add/remove routes
dynamically, all on a single shared CamelContext ?
You are not able to use a private camel context per test so they run in isolation and can
be safely parallelized?

But sure you are welcome to work on a patch about the ConcurrentModificationException. But
mind that adding / removing routes takes a fair bit of logic so its not trivial to make it

> ConcurrentModificationException when adding/removing routes in multiple threads
> -------------------------------------------------------------------------------
>                 Key: CAMEL-9237
>                 URL:
>             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

View raw message