Package io.servicetalk.log4j2.mdc.utils
Class ServiceTalkThreadContextMap
java.lang.Object
io.servicetalk.log4j2.mdc.utils.ServiceTalkThreadContextMap
- All Implemented Interfaces:
org.apache.logging.log4j.spi.CleanableThreadContextMap
,org.apache.logging.log4j.spi.ReadOnlyThreadContextMap
,org.apache.logging.log4j.spi.ThreadContextMap
,org.apache.logging.log4j.spi.ThreadContextMap2
- Direct Known Subclasses:
DefaultServiceTalkThreadContextMap
,ServiceTalkTracingThreadContextMap
public class ServiceTalkThreadContextMap
extends Object
implements org.apache.logging.log4j.spi.ReadOnlyThreadContextMap, org.apache.logging.log4j.spi.CleanableThreadContextMap
A
ThreadContext
that provides storage for MDC based upon AsyncContext
.-
Constructor Summary
ConstructorsConstructorDescriptionCreate a newThreadContextMap
Note: this is intended to be used via service loading and not instantiated directly.ServiceTalkThreadContextMap
(boolean useLocalStorage) Create a newThreadContextMap
Note: this is intended to be used via service loading and not instantiated directly. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
clear()
boolean
containsKey
(String key) getCopy()
org.apache.logging.log4j.util.StringMap
boolean
isEmpty()
final void
final void
final void
final void
-
Constructor Details
-
ServiceTalkThreadContextMap
public ServiceTalkThreadContextMap()Create a newThreadContextMap
Note: this is intended to be used via service loading and not instantiated directly. -
ServiceTalkThreadContextMap
public ServiceTalkThreadContextMap(boolean useLocalStorage) Create a newThreadContextMap
Note: this is intended to be used via service loading and not instantiated directly.- Parameters:
useLocalStorage
- whether to use a thread-local storage model. If false,AsyncContext
will be used. If using a thread-local storage model then theCapturedContextProvider
mechanism is necessary to properly propagate context across the reactive stream boundaries. See theMdcCapturedContextProvider
for an abstract implementation.
-
-
Method Details
-
put
- Specified by:
put
in interfaceorg.apache.logging.log4j.spi.ThreadContextMap
-
get
- Specified by:
get
in interfaceorg.apache.logging.log4j.spi.ReadOnlyThreadContextMap
- Specified by:
get
in interfaceorg.apache.logging.log4j.spi.ThreadContextMap
-
remove
- Specified by:
remove
in interfaceorg.apache.logging.log4j.spi.ThreadContextMap
-
clear
public final void clear()- Specified by:
clear
in interfaceorg.apache.logging.log4j.spi.ReadOnlyThreadContextMap
- Specified by:
clear
in interfaceorg.apache.logging.log4j.spi.ThreadContextMap
-
containsKey
- Specified by:
containsKey
in interfaceorg.apache.logging.log4j.spi.ReadOnlyThreadContextMap
- Specified by:
containsKey
in interfaceorg.apache.logging.log4j.spi.ThreadContextMap
-
getCopy
- Specified by:
getCopy
in interfaceorg.apache.logging.log4j.spi.ReadOnlyThreadContextMap
- Specified by:
getCopy
in interfaceorg.apache.logging.log4j.spi.ThreadContextMap
-
getImmutableMapOrNull
- Specified by:
getImmutableMapOrNull
in interfaceorg.apache.logging.log4j.spi.ReadOnlyThreadContextMap
- Specified by:
getImmutableMapOrNull
in interfaceorg.apache.logging.log4j.spi.ThreadContextMap
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceorg.apache.logging.log4j.spi.ReadOnlyThreadContextMap
- Specified by:
isEmpty
in interfaceorg.apache.logging.log4j.spi.ThreadContextMap
-
removeAll
- Specified by:
removeAll
in interfaceorg.apache.logging.log4j.spi.CleanableThreadContextMap
-
putAll
- Specified by:
putAll
in interfaceorg.apache.logging.log4j.spi.ThreadContextMap2
-
getReadOnlyContextData
public org.apache.logging.log4j.util.StringMap getReadOnlyContextData()- Specified by:
getReadOnlyContextData
in interfaceorg.apache.logging.log4j.spi.ReadOnlyThreadContextMap
- Specified by:
getReadOnlyContextData
in interfaceorg.apache.logging.log4j.spi.ThreadContextMap2
-
getCopyOrNull
-