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

JaxbDataFormat is not thread-safe

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.5.0, 1.6.0
    • 2.0-M1, 1.6.1
    • camel-jaxb
    • None

    Description

      JaxbDataFormat reuses the Marshaller/Unmarshaller instances.

      However, according to the https://jaxb.dev.java.net/faq/index.html#threadSafety, Marshaller/Unmarshaller instances are NOT thread safe, so you can't use them from separate threads at the same time.

      Due to this we are getting exceptions from the JAXB implementation (like ClassCastException or "org.xml.sax.SAXException: FWK005 parse may not be called while parsing."). Everything works nice with our custom JaxbDataFormat that creates new Unmarshaller/Marshaller instance on every request.

      Also, lazy-creating instances (like JAXBContext) in getter methods is not thread-safe as well (because explicit synchronization is required).

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            wfrag Ivan Dubrov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: