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(String key) |
String |
get(String key) |
protected Map<String,String> |
getCopy(Map<String,String> storage) |
protected Map<String,String> |
getImmutableMapOrNull(Map<String,String> storage) |
protected StringMap |
getReadOnlyContextData(Map<String,String> storage) |
boolean |
isEmpty() |
@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 ServiceTalkThreadContextMapprotected Map<String,String> getCopy(Map<String,String> storage)
getCopy in class ServiceTalkThreadContextMap@Nullable protected Map<String,String> getImmutableMapOrNull(Map<String,String> storage)
getImmutableMapOrNull in class ServiceTalkThreadContextMappublic boolean isEmpty()
isEmpty in interface ReadOnlyThreadContextMapisEmpty in interface ThreadContextMapisEmpty in class ServiceTalkThreadContextMapprotected StringMap getReadOnlyContextData(Map<String,String> storage)
getReadOnlyContextData in class ServiceTalkThreadContextMap