Author: ggregory
Date: Thu May  8 17:49:55 2014
New Revision: 1593347

URL: http://svn.apache.org/r1593347
Log:
Add clearAll() and deprecate clear() in favor or clearMap(). Use the active 
voice in Javadocs. clearAll must be used from tests to avoid creating test 
failures due to test ordering.

Modified:
    
logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/ThreadContext.java

Modified: 
logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/ThreadContext.java
URL: 
http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/ThreadContext.java?rev=1593347&r1=1593346&r2=1593347&view=diff
==============================================================================
--- 
logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/ThreadContext.java
 (original)
+++ 
logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/ThreadContext.java
 Thu May  8 17:49:55 2014
@@ -74,7 +74,7 @@ public final class ThreadContext  {
     /**
      * <em>Consider private, used for testing.</em>
      */
-    static void init() {
+    public static void init() {
         contextMap = null;
         final PropertiesUtil managerProps = PropertiesUtil.getProperties();
         disableAll = managerProps.getBooleanProperty(DISABLE_ALL);
@@ -162,12 +162,28 @@ public final class ThreadContext  {
 
     /**
      * Clear the context.
+     * @deprecated Use {@link #clearMap()}
      */
     public static void clear() {
         contextMap.clear();
     }
 
     /**
+     * Clears the context map.
+     */
+    public static void clearMap() {
+        contextMap.clear();
+    }
+
+    /**
+     * Clears the context map and stack.
+     */
+    public static void clearAll() {
+        clearMap();
+        clearStack();
+    }
+
+    /**
      * Determine if the key is in the context.
      * @param key The key to locate.
      * @return True if the key is in the context, false otherwise.
@@ -202,7 +218,7 @@ public final class ThreadContext  {
     }
 
     /**
-     * Clear the stack for this thread.
+     * Clears the stack for this thread.
      */
     public static void clearStack() {
         contextStack.clear();


Reply via email to