«« Next » « Previous
Subversion
Written by: Lorna Jane Mitchell
Featured Refcardz: Top Refcardz:
  1. Git
  2. DNS
  3. Data Mining
  4. Spring Data
  5. Subversion
  1. Spring Data
  2. Subversion
  3. Spring Config.
  4. Spring Annotations
  5. Data Mining

Link Details

Link 804751 thumbnail
User 884233 avatar

By screener
via javarevisited.blogspot.com
Published: Jun 11 2012 / 22:46

SimpleDateFormat is not a thread-safe class and we can not share it between multiple thread but same time using local SimpleDateFormat is expensive and a better alternative of this is using ThreadLocal variable which allows each Thread to hold its SimpleDateFormat class and since it is not shared between multiple thread, it become thread safe. Overall simple example of ThreadLocal variable in Java to understand it better.
  • 8
  • 1
  • 2098
  • 1499

Comments

Add your comment
User 287085 avatar

javawerks replied ago:

0 votes Vote down Vote up Reply

Just use immutable joda time objects, and ignore this nonsense.

User 226303 avatar

devdanke replied ago:

0 votes Vote down Vote up Reply

While I prefer the Joda date-time library, I think the solution proposed in this article is clever and simple.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (8)



Voters Against This Link (1)