• Post Reply Bookmark Topic Watch Topic
  • New Topic

SimpleDateFormat.. not Synchronized

 
lakshman lakshman
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi how to make SimpleDateFormat.. synchronized...
 
Joe Ess
Bartender
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The java documentation for SimpleDateFormat states:
Date formats are not synchronized. It is recommended to create separate format instances for each thread.

If you insist on using one instance, create a class that extends SimpleDateFormat and override every method with a synchronized version. Don't forget the methods that are inherited directly from DateFormat.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!