Java DateFormat is not threadsafe
Java DateFormat and SimpleDate classes are not threadsafe.
When an application has a few common date formats it seems natural to have them in some common place like static variables or in some kind of singleton.
However as per this bug report last updated in 2001, date format is not thread safe :-
Also the sun java doc for 1.4 and 1.5 confirms the same :-
Date formats are not synchronized. It is recommended to create separate format instances for each thread. If multiple threads access a format concurrently, it must be synchronized externally.
What does that impact ?
Well if the methods of dateformat do not use instance variables like most servlets, i guess we should be ok, even if multiple threads access the dateformat, just like servlets.
However since the javadoc "recommends to create separate format instances for each thread" we might use thread local variables to store the DateFormats. That way instead of creating a new DateFormat each time it is needed, we will get only as many DateFormats as there are threads using them.