Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-7836

ConcurrentModificationException when creating dynamic routes

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.13.1
    • Fix Version/s: 2.13.3, 2.14.1, 2.15.0
    • Component/s: camel-core
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      There is a (small) chance of ConcurrentModificationException when creating routes dynamically.

      java.util.ConcurrentModificationException
        at java.util.LinkedHashMap$LinkedHashIterator.nextEntry(LinkedHashMap.java:373)
        at java.util.LinkedHashMap$KeyIterator.next(LinkedHashMap.java:384)
        at java.util.AbstractCollection.toArray(AbstractCollection.java:124)
        at java.util.ArrayList.<init>(ArrayList.java:131)
        at org.apache.camel.impl.DefaultCamelContext.getRoutes(DefaultCamelContext.java:650)
        at org.apache.camel.impl.DefaultCamelContext.getRoute(DefaultCamelContext.java:655)
      

      The cause is that if you happen to be calling getRoute at the same time you are creating a new route then the internals of new ArrayList call collection.toArray which throws the error.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                davsclaus Claus Ibsen
                Reporter:
                mattnathan Matt Nathan
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: