Class ServiceTalkTracingThreadContextMap
java.lang.Object
io.servicetalk.log4j2.mdc.utils.ServiceTalkThreadContextMap
io.servicetalk.opentracing.log4j2.ServiceTalkTracingThreadContextMap
- 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
A
ThreadContext that provides storage for MDC based upon AsyncContext that also includes tracing
information in accessors via AsyncContextInMemoryScopeManager. Due to the read only nature of making the
tracing information available the ThreadContext map-like interface spirit is not strictly followed. This is
due to the fact that modifier methods (e.g. ServiceTalkThreadContextMap.put(String, String), ServiceTalkThreadContextMap.clear()) will not have any impact
on this class returning tracing information from the accessor methods (e.g. get(String)). The motivation for
this behavior is to avoid a tight coupling between changes to the tracing storage having to be replicated in this MDC
storage container. The mechanics to orchestrate this add non-negligible complexity/overhead and so this class
provides a trade-off to make the tracing information available in MDC.-
Constructor Summary
ConstructorsConstructorDescriptionCreate a newThreadContextMapNote: this is intended to be used via service loading and not instantiated directly. -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(String key) getCopy()org.apache.logging.log4j.util.StringMapbooleanisEmpty()
-
Constructor Details
-
ServiceTalkTracingThreadContextMap
public ServiceTalkTracingThreadContextMap()Create a newThreadContextMapNote: this is intended to be used via service loading and not instantiated directly.
-
-
Method Details
-
get
- Specified by:
getin interfaceorg.apache.logging.log4j.spi.ReadOnlyThreadContextMap- Specified by:
getin interfaceorg.apache.logging.log4j.spi.ThreadContextMap- Overrides:
getin classServiceTalkThreadContextMap
-
containsKey
- Specified by:
containsKeyin interfaceorg.apache.logging.log4j.spi.ReadOnlyThreadContextMap- Specified by:
containsKeyin interfaceorg.apache.logging.log4j.spi.ThreadContextMap- Overrides:
containsKeyin classServiceTalkThreadContextMap
-
getCopy
- Specified by:
getCopyin interfaceorg.apache.logging.log4j.spi.ReadOnlyThreadContextMap- Specified by:
getCopyin interfaceorg.apache.logging.log4j.spi.ThreadContextMap- Overrides:
getCopyin classServiceTalkThreadContextMap
-
getImmutableMapOrNull
- Specified by:
getImmutableMapOrNullin interfaceorg.apache.logging.log4j.spi.ReadOnlyThreadContextMap- Specified by:
getImmutableMapOrNullin interfaceorg.apache.logging.log4j.spi.ThreadContextMap- Overrides:
getImmutableMapOrNullin classServiceTalkThreadContextMap
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceorg.apache.logging.log4j.spi.ReadOnlyThreadContextMap- Specified by:
isEmptyin interfaceorg.apache.logging.log4j.spi.ThreadContextMap- Overrides:
isEmptyin classServiceTalkThreadContextMap
-
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- Overrides:
getReadOnlyContextDatain classServiceTalkThreadContextMap
-
getCopyOrNull
- Overrides:
getCopyOrNullin classServiceTalkThreadContextMap
-