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) |
protected java.util.Map<java.lang.String,java.lang.String> |
getCopy(java.util.Map<java.lang.String,java.lang.String> storage)
Get a copy of this
ThreadContextMap given the underlying Map storage. |
protected java.util.Map<java.lang.String,java.lang.String> |
getImmutableMapOrNull(java.util.Map<java.lang.String,java.lang.String> storage)
Provide the implementation for
ServiceTalkThreadContextMap.getImmutableMapOrNull() given then underlying Map storage. |
protected org.apache.logging.log4j.util.StringMap |
getReadOnlyContextData(java.util.Map<java.lang.String,java.lang.String> storage)
Create a new read-only
StringMap. |
boolean |
isEmpty() |
clear, getCopy, getImmutableMapOrNull, getReadOnlyContextData, put, putAll, remove, removeAll@Nullable public java.lang.String get(java.lang.String key)
get in interface org.apache.logging.log4j.spi.ReadOnlyThreadContextMapget in interface org.apache.logging.log4j.spi.ThreadContextMapget in class ServiceTalkThreadContextMappublic boolean containsKey(java.lang.String key)
containsKey in interface org.apache.logging.log4j.spi.ReadOnlyThreadContextMapcontainsKey in interface org.apache.logging.log4j.spi.ThreadContextMapcontainsKey in class ServiceTalkThreadContextMapprotected java.util.Map<java.lang.String,java.lang.String> getCopy(java.util.Map<java.lang.String,java.lang.String> storage)
ServiceTalkThreadContextMapThreadContextMap given the underlying Map storage.getCopy in class ServiceTalkThreadContextMapstorage - the underlying Map storage.ThreadContextMap.@Nullable protected java.util.Map<java.lang.String,java.lang.String> getImmutableMapOrNull(java.util.Map<java.lang.String,java.lang.String> storage)
ServiceTalkThreadContextMapServiceTalkThreadContextMap.getImmutableMapOrNull() given then underlying Map storage.getImmutableMapOrNull in class ServiceTalkThreadContextMapstorage - the underlying Map storage.Map or null if empty.public boolean isEmpty()
isEmpty in interface org.apache.logging.log4j.spi.ReadOnlyThreadContextMapisEmpty in interface org.apache.logging.log4j.spi.ThreadContextMapisEmpty in class ServiceTalkThreadContextMapprotected org.apache.logging.log4j.util.StringMap getReadOnlyContextData(java.util.Map<java.lang.String,java.lang.String> storage)
ServiceTalkThreadContextMapStringMap.getReadOnlyContextData in class ServiceTalkThreadContextMapstorage - The underlying storage for this ThreadContextMap.StringMap.