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 newThreadContextMapNote: this is intended to be used via service loading and not instantiated directly.ServiceTalkThreadContextMap(boolean useLocalStorage) Create a newThreadContextMapNote: this is intended to be used via service loading and not instantiated directly. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidclear()booleancontainsKey(String key) getCopy()org.apache.logging.log4j.util.StringMapbooleanisEmpty()final voidfinal voidfinal voidfinal void
-
Constructor Details
-
ServiceTalkThreadContextMap
public ServiceTalkThreadContextMap()Create a newThreadContextMapNote: this is intended to be used via service loading and not instantiated directly. -
ServiceTalkThreadContextMap
public ServiceTalkThreadContextMap(boolean useLocalStorage) Create a newThreadContextMapNote: 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,AsyncContextwill be used. If using a thread-local storage model then theCapturedContextProvidermechanism is necessary to properly propagate context across the reactive stream boundaries. See theMdcCapturedContextProviderfor an abstract implementation.
-
-
Method Details
-
put
- Specified by:
putin interfaceorg.apache.logging.log4j.spi.ThreadContextMap
-
get
- Specified by:
getin interfaceorg.apache.logging.log4j.spi.ReadOnlyThreadContextMap- Specified by:
getin interfaceorg.apache.logging.log4j.spi.ThreadContextMap
-
remove
- Specified by:
removein interfaceorg.apache.logging.log4j.spi.ThreadContextMap
-
clear
public final void clear()- Specified by:
clearin interfaceorg.apache.logging.log4j.spi.ReadOnlyThreadContextMap- Specified by:
clearin interfaceorg.apache.logging.log4j.spi.ThreadContextMap
-
containsKey
- Specified by:
containsKeyin interfaceorg.apache.logging.log4j.spi.ReadOnlyThreadContextMap- Specified by:
containsKeyin interfaceorg.apache.logging.log4j.spi.ThreadContextMap
-
getCopy
- Specified by:
getCopyin interfaceorg.apache.logging.log4j.spi.ReadOnlyThreadContextMap- Specified by:
getCopyin interfaceorg.apache.logging.log4j.spi.ThreadContextMap
-
getImmutableMapOrNull
- Specified by:
getImmutableMapOrNullin interfaceorg.apache.logging.log4j.spi.ReadOnlyThreadContextMap- Specified by:
getImmutableMapOrNullin interfaceorg.apache.logging.log4j.spi.ThreadContextMap
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceorg.apache.logging.log4j.spi.ReadOnlyThreadContextMap- Specified by:
isEmptyin interfaceorg.apache.logging.log4j.spi.ThreadContextMap
-
removeAll
- Specified by:
removeAllin interfaceorg.apache.logging.log4j.spi.CleanableThreadContextMap
-
putAll
- Specified by:
putAllin interfaceorg.apache.logging.log4j.spi.ThreadContextMap2
-
getReadOnlyContextData
public org.apache.logging.log4j.util.StringMap getReadOnlyContextData()- Specified by:
getReadOnlyContextDatain interfaceorg.apache.logging.log4j.spi.ReadOnlyThreadContextMap- Specified by:
getReadOnlyContextDatain interfaceorg.apache.logging.log4j.spi.ThreadContextMap2
-
getCopyOrNull
-