Package com.restfb.util
Class CachedDateFormatStrategy
java.lang.Object
com.restfb.util.CachedDateFormatStrategy
- All Implemented Interfaces:
DateFormatStrategy
a DateFormat strategy that returns a cached SimpleDateFormat instance.
For every format string an instance of the SimpleDateFormat is saved on a per thread base, so the SimpleDateFormat instance is reused and you get an major speedup.
Attention: to prevent a possible memory leak while using this strategy you have to clean up the inner ThreadLocal
with the clearThreadLocal
method.
- Since:
- 1.7.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
fetch the DateFormat instance that is used to parse a date in the DateUtils
-
Constructor Details
-
CachedDateFormatStrategy
public CachedDateFormatStrategy()
-
-
Method Details
-
formatFor
Description copied from interface:DateFormatStrategy
fetch the DateFormat instance that is used to parse a date in the DateUtils- Specified by:
formatFor
in interfaceDateFormatStrategy
- Parameters:
format
- the format pattern as string- Returns:
- a DateFormat instance
-
clearThreadLocal
-