public class ServiceTalkThreadContextMap
extends Object
implements ReadOnlyThreadContextMap, CleanableThreadContextMap
ThreadContext that provides storage for MDC based upon AsyncContext.| Constructor and Description |
|---|
ServiceTalkThreadContextMap()
Create a new
ThreadContextMap
Note: this is intended to be used via service loading and not instantiated directly. |
ServiceTalkThreadContextMap(boolean useLocalStorage)
Create a new
ThreadContextMap
Note: this is intended to be used via service loading and not instantiated directly. |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
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() |
void |
put(String key,
String value) |
void |
putAll(Map<String,String> map) |
void |
remove(String key) |
void |
removeAll(Iterable<String> keys) |
public ServiceTalkThreadContextMap()
ThreadContextMap
Note: this is intended to be used via service loading and not instantiated directly.public ServiceTalkThreadContextMap(boolean useLocalStorage)
ThreadContextMap
Note: this is intended to be used via service loading and not instantiated directly.useLocalStorage - whether to use a thread-local storage model. If false, AsyncContext will be used.
If using a thread-local storage model then the
CapturedContextProvider mechanism is necessary to
properly propagate context across the reactive stream boundaries. See the
MdcCapturedContextProvider for an abstract implementation.public final void put(String key,
String value)
put in interface ThreadContextMap@Nullable public String get(String key)
get in interface ReadOnlyThreadContextMapget in interface ThreadContextMappublic final void remove(String key)
remove in interface ThreadContextMappublic final void clear()
clear in interface ReadOnlyThreadContextMapclear in interface ThreadContextMappublic boolean containsKey(String key)
containsKey in interface ReadOnlyThreadContextMapcontainsKey in interface ThreadContextMappublic Map<String,String> getCopy()
getCopy in interface ReadOnlyThreadContextMapgetCopy in interface ThreadContextMap@Nullable public Map<String,String> getImmutableMapOrNull()
getImmutableMapOrNull in interface ReadOnlyThreadContextMapgetImmutableMapOrNull in interface ThreadContextMappublic boolean isEmpty()
isEmpty in interface ReadOnlyThreadContextMapisEmpty in interface ThreadContextMappublic final void removeAll(Iterable<String> keys)
removeAll in interface CleanableThreadContextMappublic final void putAll(Map<String,String> map)
putAll in interface ThreadContextMap2public StringMap getReadOnlyContextData()
getReadOnlyContextData in interface ReadOnlyThreadContextMapgetReadOnlyContextData in interface ThreadContextMap2@Nullable protected Map<String,String> getCopyOrNull()