Package io.micronaut.core.propagation
Interface ThreadPropagatedContextElement<S>
- Type Parameters:
S- The type held by the wrapped thread-scoped variable.
- All Superinterfaces:
PropagatedContextElement
- All Known Implementing Classes:
MdcPropagationContext
A
PropagatedContextElement that bridges to code that uses thread local storage instead of
PropagatedContext. The object returned by updateThreadContext() will be given
to restoreThreadContext(Object) when the propagation scope is closed.- Since:
- 4.0.0
- Author:
- Denis Stepanov
-
Method Summary
Modifier and TypeMethodDescriptionvoidrestoreThreadContext(@Nullable S oldState) Restore the state on the propagation exit.@Nullable SUpdate the thread context on the propagation entry and return the state that will be used for the restore on the propagation exit.
-
Method Details
-
updateThreadContext
@Nullable S updateThreadContext()Update the thread context on the propagation entry and return the state that will be used for the restore on the propagation exit.- Returns:
- The state to be restored
-
restoreThreadContext
Restore the state on the propagation exit.- Parameters:
oldState- The state to be restored
-