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 Rick Bullotta <ri...@lighthammer.com> on 2004/08/25 22:36:04 UTC
Safe to use singleton DocumentBuilderFactory?
It is acceptable/safe to create a single static DocumentBuilderFactory
instance and use it from many threads to create DocumentBuilder instances?
Thanks!
Rick Bullotta
CTO
Lighthammer Software (http://www.lighthammer.com)
-----Original Message-----
From: Pallavi Patil [mailto:pallavipatil_1@yahoo.com]
Sent: Wednesday, August 25, 2004 2:06 PM
To: xerces-j-user@xml.apache.org
Subject: ref attribute
Hi,
I want to check if element has ref attribute set or
not, can anyone help me how can I check it?
Thanks.
_______________________________
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.
http://promotions.yahoo.com/goldrush
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: Safe to use singleton DocumentBuilderFactory?
Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hello Rick,
Instances of javax.xml.parsers.DocumentBuilderFactory [1] are not
guaranteed to be thread-safe, so accessing an instance of this class
across multiple threads should be synchronized by your application. The
javadoc for DocumentBuilderFactory states that: "an application can use
the same instance of the factory to obtain one or more instances of the
DocumentBuilder provided the instance of the factory isn't being used in
more than one thread at a time". Unless you're doing something strange
like modifying the configuration of the factory while a DocumentBuilder is
being instantiated on another thread, I don't think you'd run into
problems with the current implementation in Xerces, but you can't count on
that since DocumentBuilderFactory makes no guarantees.
[1] http://java.sun.com/j2se/1.4
.2/docs/api/javax/xml/parsers/DocumentBuilderFactory.html
"Rick Bullotta" <ri...@lighthammer.com> wrote on 08/25/2004
04:36:04 PM:
> It is acceptable/safe to create a single static DocumentBuilderFactory
> instance and use it from many threads to create DocumentBuilder
instances?
>
> Thanks!
>
> Rick Bullotta
> CTO
> Lighthammer Software (http://www.lighthammer.com)
>
>
> -----Original Message-----
> From: Pallavi Patil [mailto:pallavipatil_1@yahoo.com]
> Sent: Wednesday, August 25, 2004 2:06 PM
> To: xerces-j-user@xml.apache.org
> Subject: ref attribute
>
> Hi,
> I want to check if element has ref attribute set or
> not, can anyone help me how can I check it?
> Thanks.
>
>
>
>
> _______________________________
> Do you Yahoo!?
> Win 1 of 4,000 free domain names from Yahoo! Enter now.
> http://promotions.yahoo.com/goldrush
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org