pa7751 Posted October 22, 2012 Share Posted October 22, 2012 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? Link to comment Share on other sites More sharing options...
boen_robot Posted October 22, 2012 Share Posted October 22, 2012 You could write separate XML files, and only merge them in the end by a final thread that waits for all others to finish. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now