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
public final class ServiceTalkTracingThreadContextMap extends ServiceTalkThreadContextMap
AThreadContextthat provides storage for MDC based uponAsyncContextthat also includes tracing information in accessors viaAsyncContextInMemoryScopeManager. Due to the read only nature of making the tracing information available theThreadContextmap-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 Constructor Description ServiceTalkTracingThreadContextMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsKey(java.lang.String key)java.lang.Stringget(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.StringMapgetReadOnlyContextData()booleanisEmpty()
-
-
-
Method Detail
-
get
@Nullable public java.lang.String get(java.lang.String key)
- Specified by:
getin interfaceorg.apache.logging.log4j.spi.ReadOnlyThreadContextMap- Specified by:
getin interfaceorg.apache.logging.log4j.spi.ThreadContextMap- Overrides:
getin classServiceTalkThreadContextMap
-
containsKey
public boolean containsKey(java.lang.String key)
- Specified by:
containsKeyin interfaceorg.apache.logging.log4j.spi.ReadOnlyThreadContextMap- Specified by:
containsKeyin interfaceorg.apache.logging.log4j.spi.ThreadContextMap- Overrides:
containsKeyin classServiceTalkThreadContextMap
-
getCopy
public java.util.Map<java.lang.String,java.lang.String> getCopy()
- Specified by:
getCopyin interfaceorg.apache.logging.log4j.spi.ReadOnlyThreadContextMap- Specified by:
getCopyin interfaceorg.apache.logging.log4j.spi.ThreadContextMap- Overrides:
getCopyin classServiceTalkThreadContextMap
-
getImmutableMapOrNull
@Nullable public java.util.Map<java.lang.String,java.lang.String> 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
@Nullable protected java.util.Map<java.lang.String,java.lang.String> getCopyOrNull()
- Overrides:
getCopyOrNullin classServiceTalkThreadContextMap
-
-