[jdom-interest] Using XPath in Multi-Threaded Env
Laurent Bihanic
laurent.bihanic at atosorigin.com
Fri Jun 6 00:04:30 PDT 2003
Rajan Gupta wrote:
> Is it possible to reuse an instance of XPath across multiple threads of
> execution using different instances of DOM Documents in each thread?
Yes and no!
No because, as no JDOM object is threadsafe, XPath was not designed to be
threadsafe. For JaxenXPath to be threadsafe, context should be made a thread
local variable.
Yes because I do it all the time and it works. For that, you should not rely
on the automatic context-based namespace prefix resolution feature. Which mean
you should define all namespace prefix mappings using XPath.addNamespace().
Laurent
More information about the jdom-interest
mailing list