Skip to content
Snippets Groups Projects
Commit 9f95258e authored by ribeaudc's avatar ribeaudc
Browse files

add: - 'DateFormatThreadLocal': a 'ThreadLocal' extension initialized with a 'SimpleDateFormat'.

SVN: 6297
parent 89aea012
No related branches found
No related tags found
No related merge requests found
...@@ -16,9 +16,10 @@ ...@@ -16,9 +16,10 @@
package ch.systemsx.cisd.bds; package ch.systemsx.cisd.bds;
import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import ch.systemsx.cisd.common.utilities.DateFormatThreadLocal;
/** /**
* Some constants used inside the <i>BDS</i> library * Some constants used inside the <i>BDS</i> library
* *
...@@ -34,16 +35,8 @@ public final class Constants ...@@ -34,16 +35,8 @@ public final class Constants
public final static char PATH_SEPARATOR = '/'; public final static char PATH_SEPARATOR = '/';
/** The uniformly date format used. */ /** The uniformly date format used. */
// Note that DateFormats objects are not thread-safe. public static final ThreadLocal<SimpleDateFormat> DATE_FORMAT =
public static final ThreadLocal<DateFormat> DATE_FORMAT = new DateFormatThreadLocal(DATE_FORMAT_PATTERN);
new ThreadLocal<DateFormat>()
{
@Override
protected DateFormat initialValue()
{
return new SimpleDateFormat(DATE_FORMAT_PATTERN);
}
};
private Constants() private Constants()
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment