Are there any objections to this before I make this change for Takashi?

I hate to ask this kind of question, because "silence == consent", but when I don't it comes back to bite me (sometimes). We are all busy, but even a quick proactive -1 (we can presume the +1's), if that is your opinion, would help those of us who are not intimately familiar with the details and/or design objectives to know if we can step in to do some of the dirty work.

Thanks, <ras>

<ras>

*******************************************
Richard A. Sitze [EMAIL PROTECTED]
CORBA Interoperability & WebServices
IBM WebSphere Development
"Takashi Okamoto" <[EMAIL PROTECTED]>




          "Takashi Okamoto" <[EMAIL PROTECTED]>

          06/11/2002 03:42 AM
          Please respond to axis-dev



To: <[EMAIL PROTECTED]>
cc:
Subject: Is axis client thread safe?(with patch)



Hi, axis.

Is Axis(beta2) Client thread safe? How can I use AxisClient in
multi-thread? I have a problem that SOAPBodyElement is broken by
executing Call.invoke() under multi-thread environment. It seems not
to resolve recent cvs snapshots. Here is message:


java.lang.NullPointerException
at org.apache.xerces.dom.ParentNode.nodeListGetLength(ParentNode.java:739)
at org.apache.xerces.dom.ParentNode.getLength(ParentNode.java:751)
at org.apache.axis.encoding.SerializationContextImpl.writeDOMElement(SerializationContextImpl.java:913)
at org.apache.axis.message.MessageElement.outputImpl(MessageElement.java:661)
at org.apache.axis.message.MessageElement.output(MessageElement.java:651)
at org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:382)
at org.apache.axis.message.MessageElement.output(MessageElement.java:651)
at org.apache.axis.SOAPPart.getAsString(SOAPPart.java:379)
at org.apache.axis.SOAPPart.getAsBytes(SOAPPart.java:306)
at org.apache.axis.Message.getContentLength(Message.java:334)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:382)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:154)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:121)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:174)
at org.apache.axis.client.Call.invoke(Call.java:1905)
at org.apache.axis.client.Call.invoke(Call.java:1155)



I haven't resolved it completely but at least, I doubt
dbf(DocumentBuilder) and saxFactory(SAXParserFactory) at XMLUtils.java
is thread unsafe by following description:


http://xml.apache.org/xalan-j/apidocs/javax/xml/parsers/SAXParserFactory.html
> An implementation of the SAXParserFactory class is NOT guaranteed to
> be thread safe.


http://xml.apache.org/xalan-j/apidocs/javax/xml/parsers/DocumentBuilder.html
> An implementation of the DocumentBuilderFactory class is NOT
> guaranteed to be thread safe.


I attached a patch for it.

regards,

Takashi Okamoto [EMAIL PROTECTED]
NTTDATA Coop. R&D Headquarters



--- XMLUtils.java.orig 2002-06-11 17:17:12.000000000 +0900
+++ XMLUtils.java 2002-06-11 17:20:32.000000000 +0900
@@ -193,7 +193,9 @@
return (SAXParser )saxParsers.pop();
}
try {
+ synchronized (saxFactory) {
return saxFactory.newSAXParser();
+ }


} catch (ParserConfigurationException e) {
log.error(JavaUtils.getMessage("parserConfigurationException00"), e
);
@@ -230,7 +232,9 @@


public static Document newDocument() {
try {
- return dbf.newDocumentBuilder().newDocument();
+ synchronized (dbf) {
+ return dbf.newDocumentBuilder().newDocument();
+ }
} catch (Exception e) {
return null;
}
@@ -238,7 +242,9 @@


public static Document newDocument(InputSource inp) {
try {
- DocumentBuilder db = dbf.newDocumentBuilder();
+ synchronized (dbf) {
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ }
db.setErrorHandler( new ParserErrorHandler() );
return( db.parse( inp ) );
}


Reply via email to