public interface ReadOnlyThreadContextMap
ThreadContext.
ThreadContextMap implementations that also implement this interface can be accessed
by applications via the ThreadContext.getThreadContextMap() method.
ThreadContext.getThreadContextMap()| Modifier and Type | Method and 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. |
StringMap |
getReadOnlyContextData()
Returns the context data for reading.
|
boolean |
isEmpty()
Returns true if the Map is empty.
|
void clear()
boolean containsKey(String key)
key - The key to locate.String get(String key)
key parameter.
This method has no side effects.
key - The key to locate.Map<String,String> getCopy()
null mutable copy of current thread's context Map.Map<String,String> getImmutableMapOrNull()
null if the context map is empty.null.StringMap getReadOnlyContextData()
Thread safety note:
If this ReadOnlyThreadContextMap implements CopyOnWrite, then the returned StringMap can
safely be passed to another thread: future changes in the underlying context data will not be reflected in the
returned StringMap.
Otherwise, if this ReadOnlyThreadContextMap does not implement CopyOnWrite, then it is
not safe to pass the returned StringMap to another thread because changes in the underlying context may
be reflected in the returned object. It is the responsibility of the caller to make a copy to pass to another
thread.
StringMap containing context data key-value pairsboolean isEmpty()
Copyright © 1999-2019 The 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.