Yes you are correct.

The SimpleDeserializers could be shared per thread.  Deserializers for
multi-ref'd things cannot be shared at all.

Rich Scheuerle
XML & Web Services Development
512-838-5115  (IBM TL 678-5115)


                                                                                       
                                     
                      Glen Daniels                                                     
                                     
                      <gdaniels@macrome        To:       "'Axis-Dev (E-mail)'" 
<[EMAIL PROTECTED]>                    
                      dia.com>                 cc:                                     
                                     
                                               Subject:  Concurrency problems (Attn: 
Rich)                                  
                      05/01/2002 03:22                                                 
                                     
                      PM                                                               
                                     
                      Please respond to                                                
                                     
                      axis-dev                                                         
                                     
                                                                                       
                                     
                                                                                       
                                     




I isolated the concurrency failures to two places.  First,
SAXParserFactories are not guaranteed to be thread-safe, so I synchronized
the saxFactory.newSAXParser() call.

Second, and much more major - we are apparently "sharing" instances of
SimpleDeserializers....?!?  I don't understand how this could work in a
multi-threaded environment, when each deserializer is maintaining a
StringBuffer collecting values from deserialized XML....

I propose we remove all of the code related to sharing deserializers.
Serializers may be shared, since they don't have state, but Deserializers
must be created on a per-instance basis, or must be redesigned to hold
state in TLS or some other thread-safe place.  I may be missing something
here, so please fill me in if you think this is an incorrect analysis.  I
will note that turning off sharing in all cases has fixed the concurrency
test problems.

Sorry for not noticing and commenting on this earlier.

--Glen



Reply via email to