Class ThreadContextDataInjector.ForGarbageFreeThreadContextMap
- java.lang.Object
-
- org.apache.logging.log4j.core.impl.ThreadContextDataInjector.ForGarbageFreeThreadContextMap
-
- All Implemented Interfaces:
ContextDataInjector
- Enclosing class:
- ThreadContextDataInjector
public static class ThreadContextDataInjector.ForGarbageFreeThreadContextMap extends java.lang.Object implements ContextDataInjector
TheContextDataInjectorused when the ThreadContextMap implementation is a garbage-free StringMap-based data structure.This injector always puts key-value pairs into the specified reusable StringMap.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<ContextDataProvider>providers
-
Constructor Summary
Constructors Constructor Description ForGarbageFreeThreadContextMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringMapinjectContextData(java.util.List<Property> props, StringMap reusable)Puts key-value pairs from both the specified list of properties as well as the thread context into the specified reusable StringMap.ReadOnlyStringMaprawContextData()Returns aReadOnlyStringMapobject reflecting the current state of the context.
-
-
-
Field Detail
-
providers
private final java.util.List<ContextDataProvider> providers
-
-
Method Detail
-
injectContextData
public StringMap injectContextData(java.util.List<Property> props, StringMap reusable)
Puts key-value pairs from both the specified list of properties as well as the thread context into the specified reusable StringMap.- Specified by:
injectContextDatain interfaceContextDataInjector- Parameters:
props- list of configuration properties, may benullreusable- aStringMapinstance that may be reused to avoid creating temporary objects- Returns:
- a
StringMapcombining configuration properties with thread context data - See Also:
ThreadContextDataInjector.copyProperties(List, StringMap)
-
rawContextData
public ReadOnlyStringMap 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.
- Specified by:
rawContextDatain interfaceContextDataInjector- Returns:
- a
ReadOnlyStringMapobject reflecting the current state of the context, may not returnnull
-
-