[jdom-interest] Thread safe question: OK for simultaneous read-only access?

bob mcwhirter bob at werken.com
Sun Oct 28 07:03:54 PST 2001

On Sun, 28 Oct 2001, Bradley S. Huffman wrote:

> bob mcwhirter writes:
> > If you want to read and write across a shared document, then I
> > suggest implementing a ReadWriteLock, associated with the Document
> > object, or similar, for maximum efficiency.
> To anyone working on this, I'd like locking at the branch level :)

Do you mean the Element level?

The only problem I see with that is, given:


If one thread is processing <c>, and another takes <b>, and removes
it from the document altogether, then where does that leave the guy
processing <c>?  Similar to if two threads have an Iterator, and
one thread removes an object from the backing list.   A JDOM document
is just an N-dimensional collection, where most java.util.Collections
are just 1-dimensional (well, Maps are 2-D).

I doubt that JDOM will ever include any sort of locking.


More information about the jdom-interest mailing list