Package org.ka2ddo.util
Class NonshareableDateFormatCache
java.lang.Object
org.ka2ddo.util.NonshareableDateFormatCache
This class provides a cache of SimpleDateFormat objects, such that they don't have to be
recreated over and over, yet the users can be reasonably assured that no one else is using the
instance they are using.
Note this class does not wrap the SimpleDateFormat objects to ensure they are not being used by threads that didn't actually request them. That can be added if problems still occur.
- Author:
- Andrew Pavlin, KA2DDO
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic SimpleDateFormat
Get a SimpleDateFormat object with the specified format, pre-initialized to UTC timezone.static void
release
(SimpleDateFormat sdf) Return a SimpleDateFormat object to the appropriate queue.toString()
Returns a string representation of the object.
-
Constructor Details
-
NonshareableDateFormatCache
public NonshareableDateFormatCache()
-
-
Method Details
-
get
Get a SimpleDateFormat object with the specified format, pre-initialized to UTC timezone.- Parameters:
format
- format String to use- Returns:
- SimpleDateFormat object with the specified format
-
release
Return a SimpleDateFormat object to the appropriate queue.- Parameters:
sdf
- SimpleDateFormat object to return
-
toString
Returns a string representation of the object.
-