You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2012/07/22 14:16:53 UTC

svn commit: r1364274 - /httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/cookie/DateUtils.java

Author: olegk
Date: Sun Jul 22 12:16:52 2012
New Revision: 1364274

URL: http://svn.apache.org/viewvc?rev=1364274&view=rev
Log:
HTTPCLIENT-1216: Added method to force clean thread-local used by DateUtils

Modified:
    httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/cookie/DateUtils.java

Modified: httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/cookie/DateUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/cookie/DateUtils.java?rev=1364274&r1=1364273&r2=1364274&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/cookie/DateUtils.java (original)
+++ httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/cookie/DateUtils.java Sun Jul 22 12:16:52 2012
@@ -28,6 +28,7 @@
 package org.apache.http.impl.cookie;
 
 import java.lang.ref.SoftReference;
+import java.text.DateFormat;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
@@ -200,6 +201,13 @@ public final class DateUtils {
         return formatter.format(date);
     }
 
+    /**
+     * Clears thread-local variable containing {@link DateFormat} cache.
+     */
+    public static void clearThreadLocal() {
+        DateFormatHolder.clearThreadLocal();
+    }
+
     /** This class should not be instantiated. */
     private DateUtils() {
     }
@@ -254,6 +262,10 @@ public final class DateUtils {
             return format;
         }
 
+        public static void clearThreadLocal() {
+            THREADLOCAL_FORMATS.remove();
+        }
+
     }
 
 }