As Tony points out, you could use a sort of Object Pool to hand out
SimeplDateFormat insatnces to your deserializer instances as the
factory constructs them, and devise a scheme to return them to the pool
when the deserializer is no longer needed. You could also make a wrapper around SimpleDateFormat that is synchronized so as to be thread safe. IIRC, the problem with SimpleDateFormat was that they have a Calendar member variable in the class. This is not used to maintain state, btu just to avoid re-creating a Calendar instance in each SimpleDateFormat method call that might need a Calendar. For the longest time, the lack of thread safety was a porblem. Recently, they "fixed" this by simply documenting it in the JavaDocs. I would urge you to consider writing your won custom date formatter/parser. Assumign you have a specific textual representation of dates you'll be working with, it should be tedious but straight forward. Thsi would give you the needed thread safety without the overhead of synchronization or the complexity of managing a pool. Regards, Brian. Martin Heitz wrote:
|
Title: Nachricht
- Serializer- and Deserializer-objects multi-threaded? Martin Heitz
- Re: Serializer- and Deserializer-objects multi-thr... tony . q . weddle
- Re: Serializer- and Deserializer-objects multi-thr... Brian J. Sayatovic
- RE: Serializer- and Deserializer-objects multi-thr... Martin Heitz
- RE: Serializer- and Deserializer-objects multi... tony . q . weddle
- RE: Serializer- and Deserializer-objects multi... Brian J. Sayatovic
- RE: Serializer- and Deserializer-objects multi-thr... Martin Heitz
- RE: Serializer- and Deserializer-objects multi... tony . q . weddle
- RE: Serializer- and Deserializer-objects multi-thr... Martin Heitz
- Unable to deploy typemapping error Kibaya E.
- RE: Serializer- and Deserializer-objects multi-thr... Martin Heitz