You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by pa7751 <pa...@gmail.com> on 2012/10/22 11:21:26 UTC

Multi threading and xml

Hi 

I have an xml file that has to be written by multiple threads running in
parallel. How can we ensure that the structural integrity of the xml file
i.e. many threads writing into the file can spoil the structure of the xml.
One way is to make the write method synchronized, but that is a very high
level approach with which only one thread may write at a time. So the other
threads are ready with their data but cannot write until the lock is
released. Is there a better way to do this?
-- 
View this message in context: http://old.nabble.com/Multi-threading-and-xml-tp34585906p34585906.html
Sent from the Apache XML - General mailing list archive at Nabble.com.

Re: Multi threading and xml

Posted by pa7751 <pa...@gmail.com>.
Suppose that there is a sudden power failure. In that case, some of the
memory fragments will fail to write to file. Then again the xml structure
could become inconsistent. How do we deal with this then?


Paul Libbrecht-4 wrote:
> 
> How about using DOM/JDOM/XOM to assemble the fragments to memory then
> output them (with an outputter thread or after the things are done).
> 
> If this is really massive, you could try to output the threads to separate
> files then merge things?
> 
> paul
> 
> 
> Le 22 oct. 2012 à 12:21, pa7751 a écrit :
> 
>> Hi I have an xml file that has to be written by multiple threads running
>> in parallel. How can we ensure that the structural integrity of the xml
>> file i.e. many threads writing into the file can spoil the structure of
>> the xml. One way is to make the write method synchronized, but that is a
>> very high level approach with which only one thread may write at a time.
>> So the other threads are ready with their data but cannot write until the
>> lock is released. Is there a better way to do this? 
>> View this message in context: Multi threading and xml
>> Sent from the Apache XML - General mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Multi-threading-and-xml-tp34585906p34588261.html
Sent from the Apache XML - General mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org


Re: Multi threading and xml

Posted by Paul Libbrecht <pa...@hoplahup.net>.
How about using DOM/JDOM/XOM to assemble the fragments to memory then output them (with an outputter thread or after the things are done).

If this is really massive, you could try to output the threads to separate files then merge things?

paul


Le 22 oct. 2012 à 12:21, pa7751 a écrit :

> Hi I have an xml file that has to be written by multiple threads running in parallel. How can we ensure that the structural integrity of the xml file i.e. many threads writing into the file can spoil the structure of the xml. One way is to make the write method synchronized, but that is a very high level approach with which only one thread may write at a time. So the other threads are ready with their data but cannot write until the lock is released. Is there a better way to do this? 
> View this message in context: Multi threading and xml
> Sent from the Apache XML - General mailing list archive at Nabble.com.


Re: Multi threading and xml

Posted by Paul Libbrecht <pa...@hoplahup.net>.
How about using DOM/JDOM/XOM to assemble the fragments to memory then output them (with an outputter thread or after the things are done).

If this is really massive, you could try to output the threads to separate files then merge things?

paul


Le 22 oct. 2012 à 12:21, pa7751 a écrit :

> Hi I have an xml file that has to be written by multiple threads running in parallel. How can we ensure that the structural integrity of the xml file i.e. many threads writing into the file can spoil the structure of the xml. One way is to make the write method synchronized, but that is a very high level approach with which only one thread may write at a time. So the other threads are ready with their data but cannot write until the lock is released. Is there a better way to do this? 
> View this message in context: Multi threading and xml
> Sent from the Apache XML - General mailing list archive at Nabble.com.