Author: fhanik
Date: Fri Jan 30 22:09:15 2009
New Revision: 739427
URL: http://svn.apache.org/viewvc?rev=739427&view=rev
Log:
even not used anywhere in our code, make it thread safe
Modified:
tomcat/trunk/java/org/apache/catalina/util/DateTool.java
Modified: tomcat/trunk/java/org/apache/catalina/util/DateTool.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/util/DateTool.java?rev=739427&r1=739426&r2=739427&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/util/DateTool.java (original)
+++ tomcat/trunk/java/org/apache/catalina/util/DateTool.java Fri Jan 30
22:09:15 2009
@@ -30,6 +30,7 @@
* @author Jason Hunter [[email protected]]
* @author James Todd [[email protected]]
* @author Costin Manolache
+ * @author fhanik
*/
public class DateTool {
@@ -71,26 +72,45 @@
/**
* DateFormat to be used to format dates
*/
- public final static DateFormat rfc1123Format =
- new SimpleDateFormat(RFC1123_PATTERN, LOCALE_US);
+ public final static ThreadLocal<DateFormat> rfc1123Format = new
ThreadLocal<DateFormat>() {
+ @Override
+ public DateFormat initialValue() {
+ DateFormat result = new SimpleDateFormat(RFC1123_PATTERN,
LOCALE_US);
+ result.setTimeZone(GMT_ZONE);
+ return result;
+ }
+ };
/**
* DateFormat to be used to format old netscape cookies
*/
- public final static DateFormat oldCookieFormat =
- new SimpleDateFormat(OLD_COOKIE_PATTERN, LOCALE_US);
-
- public final static DateFormat rfc1036Format =
- new SimpleDateFormat(rfc1036Pattern, LOCALE_US);
-
- public final static DateFormat asctimeFormat =
- new SimpleDateFormat(asctimePattern, LOCALE_US);
-
- static {
- rfc1123Format.setTimeZone(GMT_ZONE);
- oldCookieFormat.setTimeZone(GMT_ZONE);
- rfc1036Format.setTimeZone(GMT_ZONE);
- asctimeFormat.setTimeZone(GMT_ZONE);
- }
+ public final static ThreadLocal<DateFormat> oldCookieFormat = new
ThreadLocal<DateFormat>() {
+ @Override
+ public DateFormat initialValue() {
+ DateFormat result = new SimpleDateFormat(OLD_COOKIE_PATTERN,
LOCALE_US);
+ result.setTimeZone(GMT_ZONE);
+ return result;
+ }
+ };
+
+
+
+ public final static ThreadLocal<DateFormat> rfc1036Format = new
ThreadLocal<DateFormat>() {
+ @Override
+ public DateFormat initialValue() {
+ DateFormat result = new SimpleDateFormat(rfc1036Pattern,
LOCALE_US);
+ result.setTimeZone(GMT_ZONE);
+ return result;
+ }
+ };
+
+ public final static ThreadLocal<DateFormat> asctimeFormat = new
ThreadLocal<DateFormat>() {
+ @Override
+ public DateFormat initialValue() {
+ DateFormat result = new SimpleDateFormat(asctimePattern,
LOCALE_US);
+ result.setTimeZone(GMT_ZONE);
+ return result;
+ }
+ };
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]