You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "Michael S. Daly" <mi...@merck.com> on 2007/04/30 21:25:31 UTC

Re: xerces DOM concurrent access and defer-node-expansion

Michael Glavassevich <mrglavas <at> ca.ibm.com> writes:


> No. For example, you will run into trouble with NodeLists. Internally they 
> cache the length and previously accessed position to improve the 
> performance of calls to getLength() and item(i). Invoking these methods 
> from multiple threads (even on different NodeLists) without synchronizing 
> your application code will lead to the exceptions [1] observed by 
> Prashant. You can't count on the other read operations being thread-safe 
> either.
> 

> [1] Caused by: java.lang.NullPointerException
>  at org.apache.xerces.dom.ParentNode.nodeListGetLength(Unknown Source)
>  at org.apache.xerces.dom.ParentNode.getLength(Unknown Source)
> 

I'm running into this issue within my application. Aside from synchronizing the
code that calls these methods, are there any additional steps that need to be
taken to resolve this issue?



---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: xerces DOM concurrent access and defer-node-expansion

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hi Michael,

Provided that your code is ensuring that only one thread is accessing the 
DOM at a time (i.e. the whole structure, not just one node) you should be 
fine.

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Michael S. Daly <mi...@merck.com> wrote on 04/30/2007 03:25:31 PM:

> Michael Glavassevich <mrglavas <at> ca.ibm.com> writes:
> 
> 
> > No. For example, you will run into trouble with NodeLists. Internally 
they 
> > cache the length and previously accessed position to improve the 
> > performance of calls to getLength() and item(i). Invoking these 
methods 
> > from multiple threads (even on different NodeLists) without 
synchronizing 
> > your application code will lead to the exceptions [1] observed by 
> > Prashant. You can't count on the other read operations being 
thread-safe 
> > either.
> > 
> 
> > [1] Caused by: java.lang.NullPointerException
> >  at org.apache.xerces.dom.ParentNode.nodeListGetLength(Unknown Source)
> >  at org.apache.xerces.dom.ParentNode.getLength(Unknown Source)
> > 
> 
> I'm running into this issue within my application. Aside from 
> synchronizing the
> code that calls these methods, are there any additional steps that need 
to be
> taken to resolve this issue?
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org