You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Milind Rao <mi...@bellsouth.net> on 2004/02/24 07:51:44 UTC

SimpleDateFormat is not thread safe

I noticed that SimpleDateFormat is used as a static attribute in some classes.  The format and parse 
methods are not thread safe.  I didn't go through the usage, but possibly this could cause problems in 
multithreaded usage.



Regards
Milind



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Re: SimpleDateFormat is not thread safe

Posted by Milind Rao <mi...@bellsouth.net>.
>| I noticed that SimpleDateFormat is used as a static attribute in some
>| classes.  The format and parse methods are not thread safe.  I didn't go
>| through the usage, but possibly this could cause problems in
>| multithreaded usage.
>
>Does it use instance parameters that's modified within those methods??

Yes.   calendar, pattern etc.  Generally the pattern is the same. but calls to "format" and "parse" change the 
calendar attribute.


Regards
Milind



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Re: SimpleDateFormat is not thread safe

Posted by Endre Stølsvik <En...@Stolsvik.com>.
On Tue, 24 Feb 2004, Milind Rao wrote:

| I noticed that SimpleDateFormat is used as a static attribute in some
| classes.  The format and parse methods are not thread safe.  I didn't go
| through the usage, but possibly this could cause problems in
| multithreaded usage.

Does it use instance parameters that's modified within those methods??

Endre


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org