Class ThreadContextDataInjector.ForCopyOnWriteThreadContextMap
- All Implemented Interfaces:
ContextDataInjector
- Enclosing class:
- ThreadContextDataInjector
ContextDataInjector used when the ThreadContextMap implementation is a copy-on-write
StringMap-based data structure.
If there are no configuration properties, this injector will return the thread context's internal data structure. Otherwise the configuration properties are combined with the thread context key-value pairs into the specified reusable StringMap.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieves a single context data value.injectContextData(List<Property> props, StringMap ignore) If there are no configuration properties, this injector will return the thread context's internal data structure.Returns aReadOnlyStringMapobject reflecting the current state of the context.
-
Constructor Details
-
ForCopyOnWriteThreadContextMap
public ForCopyOnWriteThreadContextMap()
-
-
Method Details
-
injectContextData
If there are no configuration properties, this injector will return the thread context's internal data structure. Otherwise the configuration properties are combined with the thread context key-value pairs into the specified reusable StringMap.- Parameters:
props- list of configuration properties, may benullignore- aStringMapinstance from the log event- Returns:
- a
StringMapcombining configuration properties with thread context data - See Also:
-
rawContextData
Description copied from interface:ContextDataInjectorReturns aReadOnlyStringMapobject reflecting the current state of the context. Configuration properties are not included in the result.This method may be called multiple times for each log event by Filters and Lookups and implementors should take care to make this method as performant as possible while preserving at least the following thread-safety guarantee.
Thread-safety note: The returned object can only be safely used in the current thread. Changes in the underlying context may or may not be reflected in the returned object, depending on the context data source and the implementation of this method. It is not safe to pass the returned object to another thread.
- Returns:
- a
ReadOnlyStringMapobject reflecting the current state of the context, may not returnnull
-
getValue
Description copied from interface:ContextDataInjectorRetrieves a single context data value.- Specified by:
getValuein interfaceContextDataInjector- Parameters:
key- The context data key of the value to retrieve.- Returns:
- A context data value.
-