Matt,
A final declaration just means that the reference can't be changed to a
different SimpleDateFormat instance. A static declaration just means that
there is one instance of the variable for all of the instances of the class.
Neither modifier affects how the SimpleDateFormat uses internal instance
variables.

-Richard

-----Original Message-----
From: Sgarlata Matt [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 23, 2003 11:40 AM
To: Struts Users Mailing List
Subject: Re: Example of a non-threadsafe Action?


What if the SimpleDateFormat variable is declared as final and/or static?

Thanks,

Matt
----- Original Message ----- 
From: "Craig R. McClanahan" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>; "Nifty
Music" <[EMAIL PROTECTED]>
Sent: Tuesday, December 23, 2003 2:35 PM
Subject: RE: Example of a non-threadsafe Action?


> Quoting Nifty Music <[EMAIL PROTECTED]>:
>
> > Thanks Craig!  You certainly confirmed my suspicions, although I 
> > would
have
> > guessed that I could've gotten away with sharing the 
> > SimpleDateFormat variable since it wouldn't depend on any values 
> > coming in from request objects.  Could you perhaps shed some light 
> > on why it wouldn't make
sense to
> > share it?
> >
>
> Because the internal implementation of SimpleDateFormat uses instance
variables
> during parsing and formatting, so it's not thread safe :-).
>
> Craig
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to