You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rick Reumann <ma...@reumann.net> on 2002/11/06 22:55:05 UTC

Re[6]: java.util.Date


On Wednesday, November 6, 2002, 4:51:58 PM, Antoni wrote:

AR> The problem is that during execution of SimpleDateFormat.parse some private 
AR> fields of SimpleDateFormat are modified.

    Ahhhh yes thank you. I bet I have this problem in other pieces of
    my code as well. What would you recommend doing? Should I
    synchronize the convert() method? or should I do it like I
    initially had it where I created a separate instance of
    SimpleDateFormat each time in the convert method? Which would
    incur less overhead and be faster? Or maybe neither of the above
    approaches is correct?

    Thanks again for making this clearer.


-- 

Rick
mailto:maillist@reumann.net


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Re[6]: java.util.Date

Posted by Antoni Reus <an...@wanadoo.es>.
A Dimecres 06 Novembre 2002 22:55, Rick Reumann va escriure:
> On Wednesday, November 6, 2002, 4:51:58 PM, Antoni wrote:
>
> AR> The problem is that during execution of SimpleDateFormat.parse some
> private AR> fields of SimpleDateFormat are modified.
>
>     Ahhhh yes thank you. I bet I have this problem in other pieces of
>     my code as well. What would you recommend doing? Should I
>     synchronize the convert() method? or should I do it like I
>     initially had it where I created a separate instance of
>     SimpleDateFormat each time in the convert method? Which would
>     incur less overhead and be faster? Or maybe neither of the above
>     approaches is correct?
>

Your approaches are correct.

I haven't made any tests but I think that in most cases the faster method 
would be to synchronize on the SimpleDateFormat object before calling to 
format or parse.


>     Thanks again for making this clearer.



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>