Hi This is fixed by CAMEL-6630
On Thu, Aug 22, 2013 at 10:56 AM, solimo <rob...@budzko.eu> wrote: > Hello! > > Recently, I've encountered an issue (I suppose) connected with Camel's > DataFormat implementation - the JAXB one. Due to exhausting tests, which we > currently perform we've noticed that Camel's implementation uses JAXB's > instances correctly (context is thread safe but products of context are not) > except part of implementation which loads schema. > > Let's go through simple example and assume declaration as follows: > > <camel:unmarshal id="channelV2Unmarshal"> > <camel:jaxb prettyPrint="true" contextPath="my.nice.package.model" > schema="schema-resource"/> > </camel:unmarshal> > > Provided that route with such declaration allows concurrent processing (form > example thread pool) camel *might* throw exceptions like > org.xml.sax.SAXException (FWK005 parse may not be called while parsing). As > probably most of us perfectly know, such exception might be seen when some > JAXB instances are shared across many threads. Due to the fact that camels > implementation of this DataFormat is correct for marshalling/unmarshalling, > then removing "schema" attribute will solve the problem. Why - because of > SCHEMA_FACTORY field owned by JaxbDataFormat. Note that it's assigned > statically and then used in createUnmarshaller/createMarshaller. > Implementation of those method will use non thread safe instance assigned in > SCHEMA_FACTORY to create new instances of marshaller or unmarshaller for > each thread. > > I suppose, it should not work this way, because during heavy load schema > validation on Camel's JAXB DataFormat might blow routes :). > > Robert Budźko > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Camel-JAXB-DataFormat-is-not-thread-safe-tp5737748.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen