Interface ThreadPropagatedContextElement<S>

Type Parameters:
S - The type held by the wrapped thread-scoped variable.
All Superinterfaces:
PropagatedContextElement
All Known Implementing Classes:
MdcPropagationContext

public interface ThreadPropagatedContextElement<S> extends PropagatedContextElement
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 Type
    Method
    Description
    void
    restoreThreadContext(@Nullable S oldState)
    Restore the state on the propagation exit.
    @Nullable S
    Update 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

      void restoreThreadContext(@Nullable S oldState)
      Restore the state on the propagation exit.
      Parameters:
      oldState - The state to be restored