Thanks for the response. These two questions arise from use cases in a batch system. Long running jobs exist which create results objects that are marshalled into XML with Castor. Users can ask for the status of jobs at any time. When a job finishes the results are marshalled and stored in a database.
Issue 1 referred to finished jobs: 1. User makes a web service request for the status of a finished job. 2. The XML results are retrieved from the database. 3. Castor unmarshalls the XML into object A. 4. Object A is embedded inside the full results object (Object B). 5. Object B is marshalled by Castor and sent as the Web Service response. I want to avoid the unmarshall/remarshall for object A and simply return the database XML back as a property of Object B. Issue 2 refers to unfinished jobs: 1. User makes a web service request for the status of an unfinished job. 2. Object B contains a results object (Object A). Object A contains some java.util.SynchronizedList objects. 3. Castor marshalls Object A to XML but does not synchronize when iterating through the SynchronizedList. If a new result is added to the list during synchronization then an exception is thrown. I can work around issue 2 by making a "safe" copy of the results but it is not ideal for a couple of reasons. Any ideas? Werner Guttmann-6 wrote: > > Hi, > > d33mb33 wrote: >> Hello All >> >> I have invested time in getting Castor working to my satisfaction and the >> flexibility in the mappings have allowed me to generate xml that adheres >> to >> some difficult schemas. Thank you. >> >> I have two questions where I haven't found any information to help me. >> It >> may be that I haven't looked properly so simply pointing me in the right >> direction would be appreciated. >> >> 1. Some of my objects are marshalled into a database text field and then >> retrieved later through web services. At the moment I am using Castor to >> unmarshall and then re-marshall them. This is a waste of CPU and time, >> especially when the XML is a couple of megabytes. Can I write a field >> handler to simply return the XML? I have experimented and the best I >> have >> been able to do is get it out in a CDATA field. > Sorry, but somehow I am not sure I understand what the problem is. Can > you just rephrase your issue ? > >> 2. Some of my objects contain synchronised collections which may be >> being >> updated by other threads during marshalling. When Castor iterates >> through >> these collections a ConcurrentModificationException is thrown. I am >> working >> around this issue by creating a "safe" copy of the collection but again >> this >> isn't ideal. Is there a recommended way to handle this? > Not really. Castor XML is not really thread-safe, and is not meant to > be. But out of cusiosity, what is it you are trying to achieve. Or > rather, why do you have a need to update those object instances you are > about to marshal ? > >> I'm happy to provide clarifications if anything is unclear. >> >> Thanks in advance >> >> Dave > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > > -- View this message in context: http://www.nabble.com/Raw-Xml-Handling-and-Synchronized-Collections-tp25469976p25612480.html Sent from the Castor - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

