From 9f95258ea9e463e88ab3b3fba52e139b6b19c3ff Mon Sep 17 00:00:00 2001 From: ribeaudc <ribeaudc> Date: Mon, 26 May 2008 06:37:20 +0000 Subject: [PATCH] add: - 'DateFormatThreadLocal': a 'ThreadLocal' extension initialized with a 'SimpleDateFormat'. SVN: 6297 --- .../java/ch/systemsx/cisd/bds/Constants.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/bds/source/java/ch/systemsx/cisd/bds/Constants.java b/bds/source/java/ch/systemsx/cisd/bds/Constants.java index 650dbd33f11..0e720d6c2c9 100644 --- a/bds/source/java/ch/systemsx/cisd/bds/Constants.java +++ b/bds/source/java/ch/systemsx/cisd/bds/Constants.java @@ -16,9 +16,10 @@ package ch.systemsx.cisd.bds; -import java.text.DateFormat; import java.text.SimpleDateFormat; +import ch.systemsx.cisd.common.utilities.DateFormatThreadLocal; + /** * Some constants used inside the <i>BDS</i> library * @@ -34,16 +35,8 @@ public final class Constants public final static char PATH_SEPARATOR = '/'; /** The uniformly date format used. */ - // Note that DateFormats objects are not thread-safe. - public static final ThreadLocal<DateFormat> DATE_FORMAT = - new ThreadLocal<DateFormat>() - { - @Override - protected DateFormat initialValue() - { - return new SimpleDateFormat(DATE_FORMAT_PATTERN); - } - }; + public static final ThreadLocal<SimpleDateFormat> DATE_FORMAT = + new DateFormatThreadLocal(DATE_FORMAT_PATTERN); private Constants() { -- GitLab