Menu

#302 DateUtils uses non thread-safe DateFormat variables

CVS_Head
open
nobody
Core (45)
5
2013-02-20
2006-08-05
Miro Halas
No

DateFormat classes (SimpleDateForma) and Calendar
classes are not thread safe and therefore shouldn't be
cached and reused by multiple threads. DateUtils class
contains several public static final SimpleDateFormat
variables. If these are used at the same time by
multiple threads, an unpredictable results may occur.

Remove these public variables and replace them with
public methods that allocate new instance of each
variable every time the are called.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB