aspose file tools*
The moose likes Java in General and the fly likes Is SAXParser in JDK6 thread-safe? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Is SAXParser in JDK6 thread-safe?" Watch "Is SAXParser in JDK6 thread-safe?" New topic
Author

Is SAXParser in JDK6 thread-safe?

J Rosetto
Greenhorn

Joined: Jun 03, 2008
Posts: 21
Can anyone tell me if the SAXParser in JDK 6 is thread-safe or not?

In my application I want to have a single SAXParser (configured to use a predefined set of schemas), and have several threads use it for parsing their XML.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12806
    
    5
Since an SAX parser has to keep track of state and can only be attached to one input source, a single instance is NOT thread-safe.

Perhaps you were thinking of using a single instance of SAXParserFactory since it is the factory that gets configured with a schema, etc.

Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is SAXParser in JDK6 thread-safe?