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

ConcurrentModificationException when creating dynamic routes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.13.1
    • 2.13.3, 2.14.1, 2.15.0
    • camel-core
    • None
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: