Package org.apache.logging.log4j.spi
Class NoOpThreadContextMap
java.lang.Object
org.apache.logging.log4j.spi.NoOpThreadContextMap
- All Implemented Interfaces:
ThreadContextMap
ThreadContextMap implementation used when either of system properties disableThreadContextMap or .
disableThreadContext is true. This implementation does nothing.- Since:
- 2.7
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears the context.booleancontainsKey(String key) Determines if the key is in the context.@Nullable StringGets the context identified by thekeyparameter.getCopy()Gets a non-nullmutable copy of current thread's context Map.Returns an immutable view on the context Map ornullif the context map is empty.booleanisEmpty()Returns true if the Map is empty.voidPuts a context value (theoparameter) as identified with thekeyparameter into the current thread's context map.voidRemoves the context identified by thekeyparameter.
-
Field Details
-
INSTANCE
- Since:
- 2.24.0
-
-
Constructor Details
-
NoOpThreadContextMap
public NoOpThreadContextMap()
-
-
Method Details
-
clear
public void clear()Description copied from interface:ThreadContextMapClears the context.- Specified by:
clearin interfaceThreadContextMap
-
containsKey
Description copied from interface:ThreadContextMapDetermines if the key is in the context.- Specified by:
containsKeyin interfaceThreadContextMap- Parameters:
key- The key to locate.- Returns:
- True if the key is in the context, false otherwise.
-
get
Description copied from interface:ThreadContextMapGets the context identified by thekeyparameter.This method has no side effects.
- Specified by:
getin interfaceThreadContextMap- Parameters:
key- The key to locate.- Returns:
- The value associated with the key or null.
-
getCopy
Description copied from interface:ThreadContextMapGets a non-nullmutable copy of current thread's context Map.- Specified by:
getCopyin interfaceThreadContextMap- Returns:
- a mutable copy of the context.
-
getImmutableMapOrNull
Description copied from interface:ThreadContextMapReturns an immutable view on the context Map ornullif the context map is empty.- Specified by:
getImmutableMapOrNullin interfaceThreadContextMap- Returns:
- an immutable context Map or
null.
-
isEmpty
public boolean isEmpty()Description copied from interface:ThreadContextMapReturns true if the Map is empty.- Specified by:
isEmptyin interfaceThreadContextMap- Returns:
- true if the Map is empty, false otherwise.
-
put
Description copied from interface:ThreadContextMapPuts a context value (theoparameter) as identified with thekeyparameter into the current thread's context map.If the current thread does not have a context map it is created as a side effect.
- Specified by:
putin interfaceThreadContextMap- Parameters:
key- The key name.value- The key value.
-
remove
Description copied from interface:ThreadContextMapRemoves the context identified by thekeyparameter.- Specified by:
removein interfaceThreadContextMap- Parameters:
key- The key to remove.
-