Just to clarify, what I meant was: I believe the JDK's default JAXP implementation (Xerces) *of the DocumentBuilderFactory.newInstance() method* happens to be thread-safe, that's why it may have gone unnoticed so far.
Obviously Xerces, as a whole, is far from being thread-safe ;-) Regards, *Raúl Kripalani* Apache Camel PMC Member & Committer | Enterprise Architect, Open Source Integration specialist http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani http://blog.raulkr.net | twitter: @raulvk On Wed, Jul 31, 2013 at 11:01 PM, Raul Kripalani <r...@evosent.com> wrote: > Hi guys, > > I'm reviewing Camel's XML-related components for hotspots to improve > performance. > > Looking at the XmlConverter class, I've spotted a possible thread safety > issue with the documentBuilderFactory and transformerFactory instance > fields. They are lazily initialized once and re-used forever (provided they > weren't explicitly set by the caller). > > Can someone confirm my suspicions? I believe the JDK's default JAXP > implementation (Xerces) happens to be thread-safe, that's why it may have > gone unnoticed so far. > > P.S.: I'm considering introducing an ArrayBlockingQueue to reuse DBFs, > TransformerFactories and DocumentBuilders. > > Regards, > > *Raúl Kripalani* > Apache Camel PMC Member & Committer | Enterprise Architect, Open Source > Integration specialist > http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani > http://blog.raulkr.net | twitter: @raulvk >