Interface CapturedContext
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
The context of a thread (tracing span, SLF4J MDC, security context, …), captured by
ExecutorProvider.captureContext() so that it can be restored in tasks that run later, possibly on another
thread.- Since:
- 1.23.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CapturedContextNothing captured: tasks run unchanged. -
Method Summary
-
Field Details
-
NONE
Nothing captured: tasks run unchanged.
-
-
Method Details
-
wrap
Wraps a task so that it runs with the captured context. This may be called for several tasks that run at the same time, on any thread. The wrapped task must restore the previous context of the thread it runs on when it completes, normally or exceptionally.- Parameters:
task- the task to wrap- Returns:
- the wrapped task
-