Re: Got the Issue

2007-07-28 Thread Michael Glavassevich
Hi Prashant, That won't work either. The NodeList caches are managed by a pooling mechanism (on the Document node) which is also not thread-safe. You need a lock on the entire DOM instance. Thanks. Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [E

Re: Got the Issue

2007-07-27 Thread Nathan Beyer
__ > > > *Prashant Reddy <[EMAIL PROTECTED]>* > > 07/27/2007 10:50 AM Please respond to > [EMAIL PROTECTED] > > To > j-users@xerces.apache.org cc > Soumya Chatterjee <[EMAIL PROTECTED]> Subject > Re: Got the Issue > > > > > >

Re: Got the Issue

2007-07-27 Thread keshlam
The DOM is not promised to be threadsafe. The Xerces DOMs are not designed to be threadsafe; they are designed to be reasonably fast and compact. The fact that Node read access happens to be safe in one of our DOM implementations does not require that Nodelist also be made safe -- and in fact it

Re: Got the Issue

2007-07-27 Thread Soumya Chatterjee
hant Reddy <[EMAIL PROTECTED]> 07/27/2007 10:50 AM Please respond to [EMAIL PROTECTED] To j-users@xerces.apache.org cc Soumya Chatterjee <[EMAIL PROTECTED]> Subject Re: Got the Issue 1. XML Spec does not mandate implementations of DOM to be thread safe. 2. Xerces implementation is

Re: Got the Issue

2007-07-27 Thread Prashant Reddy
perience certainty.IT Services >Business Solutions >Outsourcing > > > > Prashant Reddy > <[EMAIL PROTECTED]> > > 07/27/2007 10:50 AM > Please respond t

Re: Got the Issue

2007-07-26 Thread Prashant Reddy
usiness Solutions > Outsourcing > > > > Michael Glavassevich > <[EMAIL PROTECTED]> > > 07/26/2007 09:51 AST > > > >To > > j-users@xerces.apache.org > >

Re: Got the Issue

2007-07-26 Thread Soumya Chatterjee
09:51 AST To   j-users@xerces.apache.org cc   Soumya Chatterjee <[EMAIL PROTECTED]> bcc   Subject   Re: Got the Issue Prashant Reddy <[EMAIL PROTECTED]> wrote on 07/26/2007 02:19:05 AM:> Like someone else suggested earlier have you tried turning off the> Defered node

Re: Got the Issue

2007-07-26 Thread Michael Glavassevich
Prashant Reddy <[EMAIL PROTECTED]> wrote on 07/26/2007 02:19:05 AM: > Like someone else suggested earlier have you tried turning off the > Defered node expansion to see if you still face any problems ? > > > Try : > docBuilderFactory.setAttribute("http://apache. > org/xml/features/dom/defer-node

Re: Got the Issue

2007-07-26 Thread keshlam
When proposing changes to Nodelist, make sure you've considered its "live view" semantics, where changes to the model are immediately visible in the list. That behavior seriously complicates implementing this interface, and it's required for a correct DOM implementation. The Xerces DOM has experim

Re: Got the Issue

2007-07-26 Thread Soumya Chatterjee
Prashant Reddy <[EMAIL PROTECTED]> 07/26/2007 11:49 AM Please respond to [EMAIL PROTECTED] To Soumya Chatterjee <[EMAIL PROTECTED]>, j-users@xerces.apache.org cc Subject Re: Got the Issue Like someone else suggested earlier have you tried turning off the Defered node expansi

Re: Got the Issue

2007-07-25 Thread Prashant Reddy
TECTED]> > > 07/25/2007 06:20 PM > Please respond to > [EMAIL PROTECTED] > > > > >To > j-users@xerces.apache.org >cc > Soumya Chatterjee > <[EMAIL PROTECTED]> > Subject > Re:

Re: Got the Issue

2007-07-25 Thread Soumya Chatterjee
__ > > > Michael Glavassevich > <[EMAIL PROTECTED]> > > 07/24/2007 07:27 PM > > >To > Soumya Chatterjee > <[EMAIL PROTECTED]> >cc > j-users@xerces.apache.org > Sub

Re: Got the Issue

2007-07-25 Thread keshlam
http://www.w3.org/DOM/faq.html#SAXandDOM __ "... Three things see no end: A loop with exit code done wrong, A semaphore untested, And the change that comes along. ..." -- "Threes" Rev 1.1 - Duane Elms / Leslie Fish (http://www.ovff.org/pegasus/songs/threes-rev

Re: Got the Issue

2007-07-25 Thread Prashant Reddy
PROTECTED]> > > 07/24/2007 07:27 PM > > >To > Soumya Chatterjee > <[EMAIL PROTECTED]> >cc > j-users@xerces.apache.org > Subject > Re: Got the Issue > > > > > > > > &g

Re: Got the Issue

2007-07-25 Thread Soumya Chatterjee
ED]> cc j-users@xerces.apache.org Subject Re: Got the Issue Hi Soumya, Xerces' DOM implementation isn't thread-safe. If you try to access the same DOM instance from multiple threads without synchronizing it you'll run into these problems. You either need to synchronize your

Re: Got the Issue

2007-07-25 Thread Soumya Chatterjee
Outsourcing Michael Glavassevich <[EMAIL PROTECTED]> 07/25/2007 02:00 AM To j-users@xerces.apache.org cc Soumya Chatterjee <[EMAIL PROTECTED]> Subject Re: Got the Issue Every Node in the Xerces DOM is also its child NodeLis

Re: Got the Issue

2007-07-24 Thread Michael Glavassevich
Every Node in the Xerces DOM is also its child NodeList (i.e. node == node.getChildNodes()). You get the same object every time. If a single thread is doing something like: ... NodeList list = node.getChildNodes(); int length = list.getLength(); for (int i = 0; i < length; ++i) { for (int j =

Re: Got the Issue

2007-07-24 Thread Soumya Chatterjee
SolutionsOutsourcing Michael Glavassevich <[EMAIL PROTECTED]> 07/24/2007 15:29 AST To   j-users@xerces.apache.org cc   Soumya Chatterjee <[EMAIL PROTECTED]> bcc   Subject   Re: Got the Issue The non-deferred DOM (yes it's still supported; it's the default impl

Re: Got the Issue

2007-07-24 Thread keshlam
Right. I wouldn't expect nodelists to be threadsafe, but do we reuse nodelists, or would independent calls to retrieve the same nodelist return separate (non-entangled) objects? I would expect the latter, since there could be several nodelist accesses in progress at once even for a single thread.

Re: Got the Issue

2007-07-24 Thread Michael Glavassevich
The non-deferred DOM (yes it's still supported; it's the default impl for an LSParser) isn't thread-safe for reads either. For instance, it caches the last position accessed in a NodeList (returned from Node.getChildNodes()) as well as its length. This is done for performance reasons. Without i

Re: Got the Issue

2007-07-24 Thread keshlam
Per the W3C spec, the DOM API does not promise to support multithread access. Doing so would impose performance/implementation limitations on all applications, even single-threaded ones, which was considered undesirable. Also, in most cases what you really need is threadsafety at a much higher lev

Re: Got the Issue

2007-07-24 Thread Soumya Chatterjee
esBusiness SolutionsOutsourcing Prashant Reddy <[EMAIL PROTECTED]> 07/24/2007 19:59 Please respond to [EMAIL PROTECTED] To   j-users@xerces.apache.org cc   Soumya Chatterjee <[EMAIL PROTECTED]> bcc   Subject   Re: Got the Issue On Tue, 2007-07-24 at 09:57 -0400, Michael Glavassevich w

Re: Got the Issue

2007-07-24 Thread Soumya Chatterjee
://www.tcs.comExperience certainty. IT ServicesBusiness SolutionsOutsourcing Michael Glavassevich <[EMAIL PROTECTED]> 07/24/2007 09:57 AST To   Soumya Chatterjee <[EMAIL PROTECTED]> cc   j-users@xerces.apache.org bcc   Subject  

Re: Got the Issue

2007-07-24 Thread Prashant Reddy
On Tue, 2007-07-24 at 09:57 -0400, Michael Glavassevich wrote: > Synchronization is not an option in this case because there is a > > huge performance issue here. Please let me know if any way we can > > get read of this problem without using the Synchronization block. > > Is your use-case,

Re: Got the Issue

2007-07-24 Thread Michael Glavassevich
Hi Soumya, Xerces' DOM implementation isn't thread-safe. If you try to access the same DOM instance from multiple threads without synchronizing it you'll run into these problems. You either need to synchronize your code or create an instance of the DOM tree per thread. There's really no way ar