Skip to main content

jdk 1.5 dom,sax thread safety

1 reply [Last post]
oreazamu
Offline
Joined: 2009-09-07
Points: 0

Dear all,

The following JDK 1.4 dom and sax javadoc mentions about thread safety but the same description regarding dom and sax thread safety is removed with JDK 1.5.

JDK 1.4 dom and sax API:

"An implementation of DocumentBuilder is NOT guaranteed to behave as per the specification if it is used concurrently by two or more threads. It is recommended to have one instance of the DocumentBuilder per thread or it is upto the application to make sure about the use of DocumentBuilder from more than one thread"

http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/parsers/DocumentBuilde...

"An implementation of SAXParser is NOT guaranteed to behave as per the specification if it is used concurrently by two or more threads. It is recommended to have one instance of the SAXParser per thread or it is upto the application to make sure about the use of SAXParser from more than one thread. "

http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/parsers/SAXParser.html

JDK 1.5 dom and sax API:

http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/parsers/DocumentBuilde...

http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/parsers/SAXParser.html

As there is no description regarding thread safety in JDK 1.5, I would assume that we dont have to worry about it.

I am not sure if my understanding is correct or not. Can someone clarify this?

Any help/pointer is highly appreciated.

Thanks and regards,
Azam

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
pyrate
Offline
Joined: 2010-03-31
Points: 0

Hi all,



I have experienced some weird behavior in my Cocoon web application. Concurrent browsing causes sometimes broken attributes of html tags:

For example:




The "%00%00" strings are not limited to the end of an attribute, they also occur in the middle.



Another case: these divs are concurrently generated by the same code:


div style="background-color:#f9d133;color:#02246e;"

div style="background-color:#f9d133;[b]background-color:#f9d133;[/b]color:#02246e;[b]color:#02246e;[/b]"


As you can see, the second div contains duplicates, which aren't supposed to be there.

At this point i am not sure which part causes this.

I may be related to thread safety of the SAXParser, so i am very interested in clearification of this issue for JDK5 as well as JDK6.

Kind regards,

Robin