Hi, I don't speak english very very well, so this is a bit difficult for me to 
explain, but I'll try ;-) .... 

see below ...

A Dimecres 06 Novembre 2002 21:37, Rick Reumann va escriure:
> On Wednesday, November 6, 2002, 3:21:28 PM, Antoni wrote:
>
>
> AR> Keep in mind that DateFormat (and SimpleDateFormat) is not thread safe
> so you AR> have to be very careful when reusing them.
>
>     I like Max's suggestion though. I think I will move it to the
>     setFormatPattern for sure. Correct me if I'm wrong here...
>
>     Since the registration of this Converter takes places in a static
>     block in the top of my DispatchAction the setFormatPattern should
>     only be called once, since isn't only once instance of my
>     DispatchAction created (and thus only one initial load in the
>     static block?). I guess I could be extra careful and synchronize
>     setFormatPattern since I don't think that should incur too much
>     overhead since in my situation I can imagine more than one
>     instance of the Action class being created.

I have'nt looked at the beanutils Converter registration, do you have to 
register a class or an instance?

The problem here is that if there is only one instance of your class, and 
setFormatPattern is only called once, then if there are two request that 
require the use of your class a the same time, served by different threads, 
the parse method in your instance of SimpleDateFormat might be called 
concurrently, so (as it isn't thread save) it might fail.





--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>

Reply via email to