[jdom-interest] XSLTransformer.transform method - thread safe?

Laurent Bihanic laurent.bihanic at atosorigin.com
Thu Nov 15 03:17:24 PST 2007


Hi,

Clint.Redwood at xansa.com wrote:
> I've just had an XSL transform go VERY weird, and I think it may be that
> two threads tried to use the same XSLTransformer object at the same time.
> The result seemed to be that it returned the untransformed data.
> 
> I'm using the Saxon 8.9 XSLT2.0 Engine, and also there are some SAXON-SQL
> queries in the XSLT in question.
> 
> The Javadoc states that the XSLTransformer is thread safe, but I'm not sure
> if I've either found an issue with this, or if there's something not
> threadsafe in the Saxon implementation.

XSLTransformer is thread-safe in that it only shares a Templates object 
between transformations and allocate a new TrAX Transformer for every call to 
transform(). JAXP TrAX explicitely requires that Templates be thread-safe.

I don't recall ever having any multi-threading issue with Saxon.

Could it be an initialisation issue where your threads start performing 
transformations before XSLTransformer constructor finishes ?

Laurent



More information about the jdom-interest mailing list