[jdom-interest] Thread safety question

Philippe Mougin philippe.mougin at orchestranetworks.com
Wed May 30 10:38:46 PDT 2001


Hi all, I'm new to JDOM but so far my experience has been excellent.

I've some questions about thread safety, from the point of view of a user of
JDOM.

The FAQ (http://www.jdom.org/docs/faq.html) states that "The core API has
intentionally been left thread unsafe", but at the same time this FAQ states
that this is not a problem in regard to the primary JDOM use cases, and that
one of this primary use case is "Single thread reads an XML stream into JDOM
and makes it available to a run time system for read only access".

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".

If the answer is no, then.how should it be interpreted?

As a side note I'm not sure that using concept like "read only" for
describing thread safety is a good thing, because methods doing "read only"
things from the point of view of the caller can internally use things that
makes them NOT thread safe (like caches etc.).

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.

- 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.

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

Thanks for your help on this delicate issue...

Philippe Mougin - Orchestra Networks




More information about the jdom-interest mailing list