public final class ServiceTalkTracingThreadContextMap extends ServiceTalkThreadContextMap
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 and Description |
---|
ServiceTalkTracingThreadContextMap() |
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(java.lang.String key) |
java.lang.String |
get(java.lang.String key) |
java.util.Map<java.lang.String,java.lang.String> |
getCopy() |
protected java.util.Map<java.lang.String,java.lang.String> |
getCopyOrNull() |
java.util.Map<java.lang.String,java.lang.String> |
getImmutableMapOrNull() |
org.apache.logging.log4j.util.StringMap |
getReadOnlyContextData() |
boolean |
isEmpty() |
@Nullable public java.lang.String get(java.lang.String key)
get
in interface org.apache.logging.log4j.spi.ReadOnlyThreadContextMap
get
in interface org.apache.logging.log4j.spi.ThreadContextMap
get
in class ServiceTalkThreadContextMap
public boolean containsKey(java.lang.String key)
containsKey
in interface org.apache.logging.log4j.spi.ReadOnlyThreadContextMap
containsKey
in interface org.apache.logging.log4j.spi.ThreadContextMap
containsKey
in class ServiceTalkThreadContextMap
public java.util.Map<java.lang.String,java.lang.String> getCopy()
getCopy
in interface org.apache.logging.log4j.spi.ReadOnlyThreadContextMap
getCopy
in interface org.apache.logging.log4j.spi.ThreadContextMap
getCopy
in class ServiceTalkThreadContextMap
@Nullable public java.util.Map<java.lang.String,java.lang.String> getImmutableMapOrNull()
getImmutableMapOrNull
in interface org.apache.logging.log4j.spi.ReadOnlyThreadContextMap
getImmutableMapOrNull
in interface org.apache.logging.log4j.spi.ThreadContextMap
getImmutableMapOrNull
in class ServiceTalkThreadContextMap
public boolean isEmpty()
isEmpty
in interface org.apache.logging.log4j.spi.ReadOnlyThreadContextMap
isEmpty
in interface org.apache.logging.log4j.spi.ThreadContextMap
isEmpty
in class ServiceTalkThreadContextMap
public org.apache.logging.log4j.util.StringMap getReadOnlyContextData()
getReadOnlyContextData
in interface org.apache.logging.log4j.spi.ReadOnlyThreadContextMap
getReadOnlyContextData
in interface org.apache.logging.log4j.spi.ThreadContextMap2
getReadOnlyContextData
in class ServiceTalkThreadContextMap
@Nullable protected java.util.Map<java.lang.String,java.lang.String> getCopyOrNull()
getCopyOrNull
in class ServiceTalkThreadContextMap