Project

Profile

Help

is it safe to share a net.sf.saxon.xpath.XPathFactoryImpl object among all threads?

Added by bruce oy over 11 years ago

i try to make a static reference to a net.sf.saxon.xpath.XPathFactoryImpl object, after XPathFactoryImpl object is created, all methods i will call is just newXPath(). it means i will not modify it's configuration, i will not call it's any setter methods. i wanna know, is it safe to do this?


Replies (1)

RE: is it safe to share a net.sf.saxon.xpath.XPathFactoryImpl object among all threads? - Added by Michael Kay over 11 years ago

Yes, Saxon's XPathFactoryImpl object is thread-safe provided you don't change it either directly, or by updating its underlying Configuration object.

Mind you, I'm not sure that the API design of JAXP XPath lends itself well to this approach, given that the FunctionResolver and VariableResolver must be the same for all XPath expressions. In my view Saxon's s9api interface is much more flexible, and much better aligned with the concepts of "static context" and "dynamic context" as described in the W3C specifications for XPath 2.0.

    (1-1/1)

    Please register to reply