Well, there is a valueComplete() method that you could override. In the body of the method, call super.valueComplete() and then "release" your deserializer back into the pool.

If you haven't already done so, it's a good idea to download the source for Axis. Then you'll be able to investigate what is going on, which can help you come up with strategies for your design.

Tony

"Martin Heitz" <[EMAIL PROTECTED]> wrote on 16/12/2004 15:58:03:

> Hi,

>  
> I did a similar approach with not only pooling the SimpleDateFormats
> but complete Deserializers.

> Now I recognize, that returning a complete Deserializer to its pool
> in the "onEndElement" method is a bad choice, because its value was
> not yet retrieved.

> Is it assured that getValue is called always? Then I could return
> the deserializer to the pool there (if some of them get lost because
> of parsing exceptions it does not harm my simple pool
> implementation, the pool is just used to reuse existing objects, but
> new ones will be created if it is empty).

>  
> Best regards and thanks for your hints and ideas,
>    Mattin
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, December 14, 2004 1:55 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Serializer- and Deserializer-objects multi-threaded?

>
> The deserializer factory creates the deserializer. You could have
> the deserializer factory set the date format object on the
> deserializer, before it gets returned o Axis to use for
> deserializing. In this way, the deserializer factory could maintain
> a list of SimpleDateFormat objects, marking each in use, as it is
> set in a deserializer. You'd have to figure out how to mark the
> object as no longer in use, perhaps by code in the onEndElement()
> method in the deserializer.
>
> I guess you could re-use complete deserializers in this way.
>
> Tony
>
> "Martin Heitz" <[EMAIL PROTECTED]> wrote on
> 14/12/2004 12:30:13:
>
> > Hi,
> >  
> > thanks for your answers.
> > The reason for asking this is, that I have (de)serializers for a
> > composed type which does not have a default constructor. So I need
> > (as far as I understand the concept) at least a deserializer for
> > rebuilding the object. One of the attributes of the object has the
> > type dateTime, so I have a SimpleDateFormat to parse this. Sorrowly
> > the SimpleDateFormat is quite expensive to create, so I do not want
> > to create one for each parse process, but have a SimpleDateFormat
> > class member in the deserializer to reuse it.
> > Now the second "but": But the SimpleDateFormat is not thread-safe,
> > it rarely occurrs that a runtime exception is thrown or that dates
> > are not formatted correctly.
> > If the deserializer is not used by multiple threads simultaneously I
> > do not have an issue here, but if it is shred I run into trouble.'
> >  
> > If - as Brian J. Sayatovic writes - Axis gets a new instance each
> > time from the factories my idea of improving performance by having a
> > SimpleDateFormat as class mebmber does not help anyway :-(
> >  
> > Best regards from sunny Black Forrest, Germany,
> >    Mattin
> >  
> >  -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, December 14, 2004 12:26 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: Serializer- and Deserializer-objects multi-threaded?
>
> >
> > I've never seen any reference to threads in descriptions of
> > serializers and deserializers (Axis 1.1). Certainly, the
> > BeanSerializer has no special code for handling multiple threads,
> > that I can see. It looks as though a new serializer/deserializer is
> > created, from the factory, each time a type needs to be processed in
> > the message. In any case, I can't quite see why you'd want to store
> > state between calls to the serializer or deserializer, or store
> > state in the de/serializer whilst processing a call.
> >
> > Tony
> >
> > "Martin Heitz" <[EMAIL PROTECTED]> wrote on
> > 14/12/2004 10:55:38:
> >
> > > Hi,
> > >
> > > short question: Are Axis Serializer- and Deserializer-objects shared by
> > > multiple threads (do they need to be thread-safe)?
> > >
> > > My question relates to Axis 1.1, but (because upgrading to a newer
> > > release is always something one may not get out of sight) I am also
> > > interested in an answer for Axis 1.2.
> > >
> > > Best regards from Black Forrest, Germany,
> > >
> > > Martin Heitz
> > > Distributed Network Accounting Team
> > >
> > > Elsag Solutions AG
> > > Roggenbachstr. 1
> > > D-78050 Villingen-Schwenningen
> > > Germany
> > > http://www.elsag-solutions.com
> > > Tel: +49-(0)7721-9175-595
> > > Fax: +49-(0)7721-9175-800
> > >  
> > >

Reply via email to