C
campus
Hi
I've this problem: I've found on
http://xml.apache.org/xerces2-j/faq-dom.html#faq-1
that DOM access is not thread safe!
I've written a class (not static) with a method containing a code like
this:
import org.w3c.dom.*;
import org.apache.xerces.*;
import org.apache.xerces.dom.*;
import org.apache.xerces.parsers.*;
import org.apache.xml.serialize.*;
//create the document object from the string of message
DOMParser parser = new DOMParser();
parser.parse(new InputSource(new StringReader(msg)));
XMLDocument = parser.getDocument();
//set the element root fo the document
rootElement = XMLDocument.getDocumentElement();
....
....
node.getFirstChild().getNodeValue();
.....
....
This class is instantiated inside a jsp and here some methods of this
class are called.
Because the jsp is translated into a servlet and the code written in
the jsp is executed by the servlet
in a thread inside the JVM of the application server, I conclude that
my class is executed in a thread.
I didn't put any "syncronize" anywhere. Have I to worry about that?
Thanks in advance for your answers.
Bye
I've this problem: I've found on
http://xml.apache.org/xerces2-j/faq-dom.html#faq-1
that DOM access is not thread safe!
I've written a class (not static) with a method containing a code like
this:
import org.w3c.dom.*;
import org.apache.xerces.*;
import org.apache.xerces.dom.*;
import org.apache.xerces.parsers.*;
import org.apache.xml.serialize.*;
//create the document object from the string of message
DOMParser parser = new DOMParser();
parser.parse(new InputSource(new StringReader(msg)));
XMLDocument = parser.getDocument();
//set the element root fo the document
rootElement = XMLDocument.getDocumentElement();
....
....
node.getFirstChild().getNodeValue();
.....
....
This class is instantiated inside a jsp and here some methods of this
class are called.
Because the jsp is translated into a servlet and the code written in
the jsp is executed by the servlet
in a thread inside the JVM of the application server, I conclude that
my class is executed in a thread.
I didn't put any "syncronize" anywhere. Have I to worry about that?
Thanks in advance for your answers.
Bye