public class DefaultThreadContextMap extends Object implements ThreadContextMap
| Modifier and Type | Field and Description |
|---|---|
static String |
INHERITABLE_MAP
Property name ("isThreadContextMapInheritable") for selecting
InheritableThreadLocal (value "true")
or plain ThreadLocal (value is not "true") in the implementation. |
| Constructor and Description |
|---|
DefaultThreadContextMap(boolean useMap) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear the context.
|
boolean |
containsKey(String key)
Determine if the key is in the context.
|
String |
get(String key)
Get the context identified by the
key parameter. |
Map<String,String> |
getCopy()
Returns a non-
null mutable copy of the ThreadContext Map. |
Map<String,String> |
getImmutableMapOrNull()
Returns either
null or an immutable view of the context Map. |
boolean |
isEmpty()
Returns true if the Map is empty.
|
void |
put(String key,
String value)
Put a context value (the
o parameter) as identified
with the key parameter into the current thread's
context map. |
void |
remove(String key)
Remove the the context identified by the
key
parameter. |
String |
toString() |
public static final String INHERITABLE_MAP
InheritableThreadLocal (value "true")
or plain ThreadLocal (value is not "true") in the implementation.public void put(String key, String value)
o parameter) as identified
with the key parameter into the current thread's
context map.
If the current thread does not have a context map it is created as a side effect.
put in interface ThreadContextMapkey - The key name.value - The key value.public String get(String key)
key parameter.
This method has no side effects.
get in interface ThreadContextMapkey - The key to locate.public void remove(String key)
key
parameter.remove in interface ThreadContextMapkey - The key to remove.public void clear()
clear in interface ThreadContextMappublic boolean containsKey(String key)
containsKey in interface ThreadContextMapkey - The key to locate.public Map<String,String> getCopy()
null mutable copy of the ThreadContext Map.getCopy in interface ThreadContextMapnull mutable copy of the context.public Map<String,String> getImmutableMapOrNull()
null or an immutable view of the context Map.getImmutableMapOrNull in interface ThreadContextMappublic boolean isEmpty()
isEmpty in interface ThreadContextMapCopyright © 1999-2014 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.