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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsKey
(String key) getCopy()
org.apache.logging.log4j.util.StringMap
boolean
isEmpty()
-
Constructor Details
-
ServiceTalkTracingThreadContextMap
public ServiceTalkTracingThreadContextMap()
-
-
Method Details
-
get
- Specified by:
get
in interfaceorg.apache.logging.log4j.spi.ReadOnlyThreadContextMap
- Specified by:
get
in interfaceorg.apache.logging.log4j.spi.ThreadContextMap
- Overrides:
get
in classServiceTalkThreadContextMap
-
containsKey
- Specified by:
containsKey
in interfaceorg.apache.logging.log4j.spi.ReadOnlyThreadContextMap
- Specified by:
containsKey
in interfaceorg.apache.logging.log4j.spi.ThreadContextMap
- Overrides:
containsKey
in classServiceTalkThreadContextMap
-
getCopy
- Specified by:
getCopy
in interfaceorg.apache.logging.log4j.spi.ReadOnlyThreadContextMap
- Specified by:
getCopy
in interfaceorg.apache.logging.log4j.spi.ThreadContextMap
- Overrides:
getCopy
in classServiceTalkThreadContextMap
-
getImmutableMapOrNull
- Specified by:
getImmutableMapOrNull
in interfaceorg.apache.logging.log4j.spi.ReadOnlyThreadContextMap
- Specified by:
getImmutableMapOrNull
in interfaceorg.apache.logging.log4j.spi.ThreadContextMap
- Overrides:
getImmutableMapOrNull
in classServiceTalkThreadContextMap
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceorg.apache.logging.log4j.spi.ReadOnlyThreadContextMap
- Specified by:
isEmpty
in interfaceorg.apache.logging.log4j.spi.ThreadContextMap
- Overrides:
isEmpty
in classServiceTalkThreadContextMap
-
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
- Overrides:
getReadOnlyContextData
in classServiceTalkThreadContextMap
-
getCopyOrNull
- Overrides:
getCopyOrNull
in classServiceTalkThreadContextMap
-