ThreadContextMap
public class NoOpThreadContextMap extends Object implements ThreadContextMap
ThreadContextMap
implementation used when either of system properties disableThreadContextMap
or .
disableThreadContext
is true
. This implementation does nothing.Constructor | Description |
---|---|
NoOpThreadContextMap() |
Modifier and Type | Method | Description |
---|---|---|
void |
clear() |
Clears the context.
|
boolean |
containsKey(String key) |
Determines if the key is in the context.
|
String |
get(String key) |
Gets the context identified by the
key parameter. |
Map<String,String> |
getCopy() |
Gets a non-
null mutable copy of current thread's context Map. |
Map<String,String> |
getImmutableMapOrNull() |
Returns an immutable view on the context Map or
null if the context map is empty. |
boolean |
isEmpty() |
Returns true if the Map is empty.
|
void |
put(String key,
String value) |
Puts a context value (the
o parameter) as identified
with the key parameter into the current thread's
context map. |
void |
remove(String key) |
Removes the the context identified by the
key
parameter. |
public void clear()
ThreadContextMap
clear
in interface ThreadContextMap
public boolean containsKey(String key)
ThreadContextMap
containsKey
in interface ThreadContextMap
key
- The key to locate.public String get(String key)
ThreadContextMap
key
parameter.
This method has no side effects.
get
in interface ThreadContextMap
key
- The key to locate.public Map<String,String> getCopy()
ThreadContextMap
null
mutable copy of current thread's context Map.getCopy
in interface ThreadContextMap
public Map<String,String> getImmutableMapOrNull()
ThreadContextMap
null
if the context map is empty.getImmutableMapOrNull
in interface ThreadContextMap
null
.public boolean isEmpty()
ThreadContextMap
isEmpty
in interface ThreadContextMap
public void put(String key, String value)
ThreadContextMap
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 ThreadContextMap
key
- The key name.value
- The key value.public void remove(String key)
ThreadContextMap
key
parameter.remove
in interface ThreadContextMap
key
- The key to remove.Copyright © 1999-2018. 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.