org.ka2ddo.util
Class NonshareableDateFormatCache

java.lang.Object
  extended by org.ka2ddo.util.NonshareableDateFormatCache

public class NonshareableDateFormatCache
extends java.lang.Object

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.


Constructor Summary
NonshareableDateFormatCache()
           
 
Method Summary
static java.text.SimpleDateFormat get(java.lang.String format)
          Get a SimpleDateFormat object with the specified format, pre-initialized to UTC timezone.
static void release(java.text.SimpleDateFormat sdf)
          Return a SimpleDateFormat object to the appropriate queue.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NonshareableDateFormatCache

public NonshareableDateFormatCache()
Method Detail

get

public static java.text.SimpleDateFormat get(java.lang.String format)
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

public static void release(java.text.SimpleDateFormat sdf)
Return a SimpleDateFormat object to the appropriate queue.

Parameters:
sdf - SimpleDateFormat object to return

toString

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the object.