Package io.servicetalk.log4j2.mdc.utils
Class MdcCapturedContextProvider
java.lang.Object
io.servicetalk.log4j2.mdc.utils.MdcCapturedContextProvider
- All Implemented Interfaces:
CapturedContextProvider
- Direct Known Subclasses:
DefaultMdcCapturedContextProvider
A
CapturedContextProvider
implementation to correctly propagate MDC context.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
MdcCapturedContextProvider
(Class<? extends ServiceTalkThreadContextMap> expectedThreadContextMapClass) Create a newCapturedContextProvider
for MDC. -
Method Summary
Modifier and TypeMethodDescriptionfinal CapturedContext
captureContext
(CapturedContext underlying) Capture a reference to existing context in preparation for an asynchronous boundary jump.final CapturedContext
captureContextCopy
(CapturedContext underlying) Capture a copy of existing context in preparation for an asynchronous boundary jump.
-
Constructor Details
-
MdcCapturedContextProvider
protected MdcCapturedContextProvider(Class<? extends ServiceTalkThreadContextMap> expectedThreadContextMapClass) Create a newCapturedContextProvider
for MDC.- Parameters:
expectedThreadContextMapClass
- the expected type of the MDCThreadContext
.
-
-
Method Details
-
captureContext
Description copied from interface:CapturedContextProvider
Capture a reference to existing context in preparation for an asynchronous boundary jump.- Specified by:
captureContext
in interfaceCapturedContextProvider
- Parameters:
underlying
- additional context that must be utilized as part of the returnedCapturedContext
, usually wrapped as described above.- Returns:
- the wrapped
CapturedContext
.
-
captureContextCopy
Description copied from interface:CapturedContextProvider
Capture a copy of existing context in preparation for an asynchronous boundary jump.- Specified by:
captureContextCopy
in interfaceCapturedContextProvider
- Parameters:
underlying
- additional context that must be utilized as part of the returnedCapturedContext
, usually wrapped as described above.- Returns:
- the wrapped
CapturedContext
.
-