Hi all,

@Oliver, I've tried running the tests but I get NPE's from both the
threadlocal version and the current version.  Have I run something
incorrectly?

java.lang.NullPointerException
        at org.apache.xerces.dom.ParentNode.nodeListItem(Unknown Source)
        at org.apache.xerces.dom.ParentNode.item(Unknown Source)
        at
org.apache.muse.test.thread.local.TestEndpointReference.<init>(TestEndpo
intReference.java:197)
        at
org.apache.muse.test.thread.local.TestThread.run(TestThread.java:60)
java.lang.NullPointerException
        at org.apache.xerces.dom.ParentNode.nodeListItem(Unknown Source)
        at org.apache.xerces.dom.ParentNode.item(Unknown Source)
        at
org.apache.muse.test.thread.local.TestEndpointReference.<init>(TestEndpo
intReference.java:197)
        at
org.apache.muse.test.thread.local.TestThread.run(TestThread.java:60) 

the shared epr and seperate docs versions shows no errors.  

The seperate doc one takes for ever, quite a performance hit on both the
synchronized for getLocalDoc, which shouldn't be necessary since
newInstance is threadsafe on DocumentBuilderFactory and the
createDocument.  I replaced the getLocalDoc with :

        static final ThreadLocal tls = new ThreadLocal(){
                protected Object initialValue() {
                         DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
                     factory.setNamespaceAware(true);
                     factory.setIgnoringComments(true);
                     try
                        {
                            return factory.newDocumentBuilder();
                        }
                        catch (ParserConfigurationException error)
                        {
                            throw new
RuntimeException(error.getMessage(), error);
                        }
                }
        };
        
    public static Document getLocalDoc() {
        return ((DocumentBuilder)tls.get()).newDocument();
        }

and it improved the performance considerably (equal with the current
solution, but correct).  Creating new documentbuilder factories is
extremly expensive, jar lookups resource creation, class loading etc.

cheers,
Chris

PS A drop in replacement of a customised axis 1.4 - does namespaces etc
correctly - runs in 128 secs (half+ the speed of the current buggy
impl).  If others are interested this version doesn't suffer threading
issues on read only, it just creates a few too many things but it could
be stripped down into a usable general dom.
PPS I'm going to start working with Vinhs tests now.

-----Original Message-----
From: Vinh Nguyen (vinguye2) [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 06, 2007 3:45 AM
To: [email protected]
Subject: RE: EMPTY_DOC thread stability issues

My test case has been posted to JIRA Muse-270:

https://issues.apache.org/jira/browse/MUSE-270
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to