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
ConstructorsModifierConstructorDescriptionprotectedMdcCapturedContextProvider(Class<? extends ServiceTalkThreadContextMap> expectedThreadContextMapClass) Create a newCapturedContextProviderfor MDC. -
Method Summary
Modifier and TypeMethodDescriptionfinal CapturedContextcaptureContext(CapturedContext underlying) Capture a reference to existing context in preparation for an asynchronous boundary jump.final CapturedContextcaptureContextCopy(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 newCapturedContextProviderfor MDC.- Parameters:
expectedThreadContextMapClass- the expected type of the MDCThreadContext.
-
-
Method Details
-
captureContext
Description copied from interface:CapturedContextProviderCapture a reference to existing context in preparation for an asynchronous boundary jump.- Specified by:
captureContextin 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:CapturedContextProviderCapture a copy of existing context in preparation for an asynchronous boundary jump.- Specified by:
captureContextCopyin interfaceCapturedContextProvider- Parameters:
underlying- additional context that must be utilized as part of the returnedCapturedContext, usually wrapped as described above.- Returns:
- the wrapped
CapturedContext.
-