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()
Create a new
ThreadContextMap
Note: this is intended to be used via service loading and not instantiated directly. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsKey(String key) |
String |
get(String key) |
Map<String,String> |
getCopy() |
protected Map<String,String> |
getCopyOrNull() |
Map<String,String> |
getImmutableMapOrNull() |
StringMap |
getReadOnlyContextData() |
boolean |
isEmpty() |
public ServiceTalkTracingThreadContextMap()
ThreadContextMap
Note: this is intended to be used via service loading and not instantiated directly.@Nullable public String get(String key)
get in interface ReadOnlyThreadContextMapget in interface ThreadContextMapget in class ServiceTalkThreadContextMappublic boolean containsKey(String key)
containsKey in interface ReadOnlyThreadContextMapcontainsKey in interface ThreadContextMapcontainsKey in class ServiceTalkThreadContextMappublic Map<String,String> getCopy()
getCopy in interface ReadOnlyThreadContextMapgetCopy in interface ThreadContextMapgetCopy in class ServiceTalkThreadContextMap@Nullable public Map<String,String> getImmutableMapOrNull()
getImmutableMapOrNull in interface ReadOnlyThreadContextMapgetImmutableMapOrNull in interface ThreadContextMapgetImmutableMapOrNull in class ServiceTalkThreadContextMappublic boolean isEmpty()
isEmpty in interface ReadOnlyThreadContextMapisEmpty in interface ThreadContextMapisEmpty in class ServiceTalkThreadContextMappublic StringMap getReadOnlyContextData()
getReadOnlyContextData in interface ReadOnlyThreadContextMapgetReadOnlyContextData in interface ThreadContextMap2getReadOnlyContextData in class ServiceTalkThreadContextMap@Nullable protected Map<String,String> getCopyOrNull()
getCopyOrNull in class ServiceTalkThreadContextMap