logo       
Google Custom Search
    AddThis Social Bookmark Button

Re: Is the xerces implementation of SAX thread-safe?: msg#00034

Subject: Re: Is the xerces implementation of SAX thread-safe?
Hi Stephan,

"Kemper, Stephan (external)" <Stephan.Kemper@xxxxxxxxxxxxxxxxxxxx> wrote 
on 06/23/2006 08:44:41 AM:

> Hi, 
> I'm using xerces 2.6.1and java 1.4.2-10 to read and validate xml-
> files with XMLSchema. Because the files can get quite big, I use SAX
> rather than DOM. The overall mechanism is : 
> 1) observe a directory 
> 2) if the directory is not empty, parse all stored xml-files in the 
> directory and stop observation 
> 3) continue observation 
> Because there are multiple directories, I use one thread per 
> directory and one SAXParser-object per thread. It seems there is a 
> concurrency-problem because if more than one thread is active 
> simultaneously, the parsed data is mixed up. 

What do you mean by "mixed up"? Could you give an example.

> I thought it would be sufficient to use one parser per thread.

This should work provided that your application code (which interacts with 
the parser) is also thread-safe.

> Is xerces using static structures that are accessible through different 
objects?

If there are static fields being used to maintain the parser's state, 
that's a bug.

> What is 
> about using xerces in a server environment (J2EE-container,...) with
> shared accesses?
> Any ideas? 
> Stephan 

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@xxxxxxxxxx
E-mail: mrglavas@xxxxxxxxxx



Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>