Package org.jboss.threads
Interface ContextHandler<T>
- Type Parameters:
T- the class of the context to capture
public interface ContextHandler<T>
A handler for propagating context from a task submitter to a task execution.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ContextHandler<?> The context handler which captures no context. -
Method Summary
Modifier and TypeMethodDescriptionCapture the current context from the submitting thread.voidRun the given task with the given captured context.
-
Field Details
-
NONE
The context handler which captures no context.
-
-
Method Details
-
captureContext
T captureContext()Capture the current context from the submitting thread.- Returns:
- the captured context
-
runWith
Run the given task with the given captured context. The context should be cleared when this method returns.- Parameters:
task- the task to run (notnull)context- the context returned fromcaptureContext()
-