hi,
        since you are using it in a servlet, you may even try keeping document
builder in threadlocal. the only thing you need to make sure is that all
the document builder have the same configuration.
        document builder access needs to be synchronized if used across thread
but by keeping it in thread local you are any way making sure that it is
accessible by that thread only. and any way in servlet model the request
is handled by one thread only. read the javadocs of document builder for
details about synchronization.
        this way you will have created just one document builder per thread
that too once in the life time of the web application.
        can you try this? i think this is the best solution and i have used the
same successfully.

regards,
nishant

On Fri, 2004-08-27 at 22:36, Christopher Ebert wrote:
>       Hi,
> 
>       I think DocumentBuilder objects can be re-used, so you could use
> an object pool, build some number of them on startup and reuse them...
> 
>       Chris
>  
> 
> -----Original Message-----
> From: Rick Bullotta [mailto:[EMAIL PROTECTED] 
> Sent: Friday, August 27, 2004 08:50
> To: [EMAIL PROTECTED]
> Subject: Xerces overriding JDK XML parser - Classloader Issues?
> 
> Here's our scenario:
> 
> We're running JDK 1.4.2_05 with the latest Xerces/Xalan in the JRE's
> lib/endorsed directory.  We run servlets (on New Atlanta's ServletExec
> engine) and are experiencing some serious performance issues when
> instantiating a parser instance from within a servlet using:
> 
> DocumentBuilderFactory dFactory = DocumentBuilderFactory.newInstance();
> dFactory.setNamespaceAware(true);
> DocumentBuilder dBuilder = dFactory.newDocumentBuilder();
> 
> We've been working with the New Atlanta folks trying to sleuth it out,
> and the issue seems to be that somewhere in the factory code are
> getResourceAsStream() calls, probably to load property or configuration
> files.  These calls seem to be performed every request, rather than
> loaded once, and when there are lots of JARS in the classpath, this
> operation can be VERY VERY expensive searching the JARS.
> 
> Question is:
> 
> Is there any way to bypass this frequent loading using either:
> 
>       a) JVM command line parameters
>       b) Setting a property through code
>       c) Some type of singleton object
> 
> Many thanks!
> 
> Rick Bullotta
> CTO
> Lighthammer Software (http://www.lighthammer.com)
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


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

Reply via email to