|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.logging.log4j.spi.DefaultThreadContextMap
public class DefaultThreadContextMap
The actual ThreadContext Map. A new ThreadContext Map is created each time it is updated and the Map stored is always immutable. This means the Map can be passed to other threads without concern that it will be updated. Since it is expected that the Map will be passed to many more log events than the number of keys it contains the performance should be much better than if the Map was copied for each event.
Field Summary | |
---|---|
static String |
INHERITABLE_MAP
Property name ("isThreadContextMapInheritable") for selecting InheritableThreadLocal (value "true")
or plain ThreadLocal (value is not "true") in the implementation. |
Constructor Summary | |
---|---|
DefaultThreadContextMap(boolean useMap)
|
Method Summary | |
---|---|
void |
clear()
Clear the context. |
boolean |
containsKey(String key)
Determine if the key is in the context. |
boolean |
equals(Object obj)
|
String |
get(String key)
Get the context identified by the key parameter. |
Map<String,String> |
getCopy()
Get a non- null mutable copy of current thread's context Map. |
Map<String,String> |
getImmutableMapOrNull()
Return an immutable view on the context Map or null if the context map is empty. |
int |
hashCode()
|
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()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String INHERITABLE_MAP
InheritableThreadLocal
(value "true")
or plain ThreadLocal
(value is not "true") in the implementation.
Constructor Detail |
---|
public DefaultThreadContextMap(boolean useMap)
Method Detail |
---|
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 String get(String key)
ThreadContextMap
key
parameter.
This method has no side effects.
get
in interface ThreadContextMap
key
- The key to locate.
public void remove(String key)
ThreadContextMap
key
parameter.
remove
in interface ThreadContextMap
key
- The key to remove.public void clear()
ThreadContextMap
clear
in interface ThreadContextMap
public boolean containsKey(String key)
ThreadContextMap
containsKey
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 String toString()
toString
in class Object
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1999-2015 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.