While refreshDocumentBuilderFactory is *always* called during initialization, it
*may* be called at any time.  For example, it may be called to specify the use
of a validating parser.  While I have never used this capability, it may be
useful to someone in the context of the SOAP implementation.

Scott

----- Original Message -----
From: "Emilio Belmonte" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 17, 2002 1:35 PM
Subject: RE: [PATCH] Re: is SOAP thread-safe?


> Actually, from the SOAP implementation point of view, the
> refreshDocumentBuilderFactory method doesn't need to be synchronized because
> that method is only called once during the servlet init() method (which is
> single threaded).  A single DocumentBuilderFactory object can be shared as
> long as it is used by one thread at a time.  Although I would agree with you
> that both methods should be synchronized if the class is used in another
> context.
>
> --Emilio
>
> -----Original Message-----
> From: Scott Nichol [mailto:[EMAIL PROTECTED]]
> Sent: Friday, May 17, 2002 7:03 PM
> To: [EMAIL PROTECTED]
> Subject: [PATCH] Re: is SOAP thread-safe?
>
>
> I don't know about whether DocumentBuilderFactory is not thread-safe, but
> refreshDocumentBuilderFactory and getXMLDocBuilder need to be synchronized
> with
> respect to one another, as the former assigns to the dbf member then calls
> methods on it to set parsing attributes.  The assignment and attribute
> setting
> should be atomic, right?
>
> I've attached the trivial patch that changes getXMLDocBuilder to be
> synchronized.
>
> Scott
>
> ----- Original Message -----
> From: "Emilio Belmonte" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, May 16, 2002 3:09 PM
> Subject: is SOAP thread-safe?
>
>
> > I noticed that this method:
> >
> > XmlParserUtils.getXMLDocBuilder()
> >
> > is not synchronized.  According to the JAXP documentation, the
> > DocumentBuilderFactory class is not thread-safe.  Is there any reason for
> > not synchronizing it?
> >
> > Thank you,
> >
> > --Emilio
> >
>

Reply via email to