[jdom-interest] Using XPath in Multi-Threaded Env

Rajan Gupta rgupta99_1999 at yahoo.com
Fri Jun 6 18:03:31 PDT 2003


Thanks for the response. 
But if were to use XPath is a threaded environment, we are assuming that
in the future the XPath code will not be changed to start using context in
some other way?
Do u have an insight into why Jason Hunter is storing context in a private
variable?

Thanks again
Rajan
--- Laurent Bihanic <laurent.bihanic at atosorigin.com> wrote:
> 
> 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
> 


__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com



More information about the jdom-interest mailing list