`
eyesmore
  • 浏览: 364788 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

技术细节之SimpleDateFormat线程安全问题

 
阅读更多

技术细节之SimpleDateFormat线程安全问题

    博客分类:
  • Java

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.

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6231579

Sun refused to accept this issue as a BUG, so we have to handle the thread-safe by ourselves.

REF:http://jroller.com/page/dschneller?entry=calendar_dateformat_and_multi_threading


java.util.Calendar也存在这个问题,更差的是,其Javadoc中一字也未提到。

搜索代码中static Calenderstatic SimpleDateFormat 吧,隐患啊,而且一般测试测不出来的。

 

REFER:  http://sharajava.iteye.com/blog/81551

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics