SimpleDateFormat的线程安全问题

SimpleDateFormat有线程安全问题。

在多线程的环境下,不使用SimpleDateFormat,或者不使用成员变量/静态成员变量的SimpleDateFormat。

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

在Sun自己的网站上。在sun的bug database中, Sun Bug #6231579   Sun Bug #6178997 都可以印证这个问题。

你可能感兴趣的:(SimpleDateFormat的线程安全问题)