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

Michael Kay mike at saxonica.com
Thu Nov 15 03:27:54 PST 2007

The JDOM XSLTransformer class is really just a wrapper for a JAXP Templates
object, so it ought to be thread-safe. Bugs are always possible, but they
need evidence!

Note that when you do a Saxon transformation using this mechanism, it copies
the input from a JDOM tree to a Saxon tree. It's also possible to do a
transformation using Saxon that operates on the JDOM tree without copying,
by creating a net.sf.saxon.jdom.DocumentWrapper and supplying that as the
Source object. (However, this won't always perform better - it depends what
the transformation is actually doing).

There's only been one multithreading bug detected in Saxon over the last
year [1], and that only affects XQuery.

Michael Kay 


> -----Original Message-----
> From: jdom-interest-bounces at jdom.org 
> [mailto:jdom-interest-bounces at jdom.org] On Behalf Of 
> Clint.Redwood at xansa.com
> Sent: 15 November 2007 10:04
> To: jdom-interest at jdom.org
> Subject: [jdom-interest] XSLTransformer.transform method - 
> thread safe?
> Hi,
> 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.
> Any suggestions as to how I could confirm this would be 
> appreaciated as I've not done much in the way of 
> multi-threaded debugging.
> Yours,
> Clint Redwood
> Senior Solutions Architect - Boots Account Xansa, a Steria 
> company t 0115 9595730 (Ext) 725730 (Int) e 
> clint.redwood at xansa.com e clint.redwood at bcm-ltd.co.uk 
> http://www.xansa.com
> Whilst this email has been checked for all known viruses, 
> recipients should undertake their own virus checking as Xansa 
> will not accept any liability whatsoever.
> This email and any files transmitted with it are confidential 
> and protected by client privilege.  It is solely for the use 
> of the intended recipient.
> Please delete it and notify the sender if you have received 
> it in error. Unauthorised use is prohibited.
> Any opinions expressed in this email are those of the 
> individual and not necessarily the organisation.
>      Xansa, Registered Office: 420 Thames Valley Park Drive,
>      Thames Valley Park, Reading, RG6 1PU, UK.
>      Registered in England No.1000954.
>      t  +44 (0)8702 416181
>      w  www.xansa.com
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@you
> rhost.com

More information about the jdom-interest mailing list