Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

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

Laurent Bihanic

2007-11-15


Hi,

Clint.Redwood@(protected):
> 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

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.