[jdom-interest] Thread safety question

philip.nelson at omniresources.com philip.nelson at omniresources.com
Thu May 31 06:26:26 PDT 2001

> Should it be interpreted as "JDOM is thread safe for read 
> only access" ?

> If the answer is yes, I would be very interested to get an 
> explanation of
> what is meant by "read only access".

No changes to the Document you are reading on multiple threads.

> More specifically, I'd like to know if the following (or part of) is
> *officially* supported by JDOM:
> - Using the method build(java.io.Reader ) on the same 
> SAXBuilder instance
> from multiple threads at the same time.

Definately not!  Whatever method is calling build should be syncronized.

> - Using the same Namespace instance as argument to the 
> methods getChild
> (java.lang.String, Namespace), getChildText(java.lang.String, 
> Namespace) and
> getChildren(java.lang.String, Namespace) of class Element, 
> from multiple
> threads at the same time.

Should not be a problem.

> - Using the method clone() on the same Document instance from multiple
> threads at the same time.

This hasn't been tested but I think that all changed variables are added
during clone so will be local to the thread.  Anyone?

More information about the jdom-interest mailing list