[jdom-interest] Piping an XML Doc between threads, How?

Ken Rune Helland kenh at csc.no
Mon Dec 10 02:03:28 PST 2001


> Sorry to bother you... I was wondering is anyone could help me through
> some confusion I am having. I am just starting to really use JDom and
> so far so good. It is a great interface to handling XML. I can not wait
> to play with the XSL stuff. But to the point...
> 

I not quite clear what you are trying to do, but if you need the document
as a JDOM object structrue in both treads, piping troug a stream is a
waste.

Just hand the reference of the org.jdom.Document object from one thread
to  the other using a queue object. 

I dont remeber if there is such a object in the util clases but
the are bound to be some awailable on the net if you cant write one 
yourself (if you are a java programer you shoud be, if you are a fresh
java  programer writing one woud be a good exersize).

Of course the queue object must use syncronization so the produsing and 
consuming threads dont interfere with each other inside the queue object,
 and the produsing thread must not use the reference. And the produsing 
object must not use the document reference after it is handed over to the
 queue, unless you use more synhronization or clone() the document object
 nad hand the clone over to the queue.


Hope this was some help.


KenR
  





More information about the jdom-interest mailing list