Matt, It doesn't matter. Since the internal implementation of DateFormat uses internal instance variables, it is not threadsafe. If two different threads access the same SimpleDateFormat.format method, there is the possibility of the formatted result to be incorrect due to the fact that the methods use the same calendar instance variable to store intermediate values when formatting. Unfortunately, it hasn't been documented in the API until J2SE 1.4.1. This is an example where the API wasn't written very well and isn't documented well. To find out more, look up "Thread Safety SimpleDateFormat" on Google.
-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]

