Top Description Fields Methods
org.jboss.threads

public Interface ContextHandler<T>

Type Parameters
<T>
the class of the context to capture

A handler for propagating context from a task submitter to a task execution.

Field Summary

Modifier and TypeField and Description
public static final ContextHandler<?>
NONE

The context handler which captures no context.

Method Summary

Modifier and TypeMethod and Description
public T

Returns:

the captured context
captureContext
()

Capture the current context from the submitting thread.

public void
runWith(Runnable
the task to run (not null)
task
,
T
the context returned from captureContext()
context
)

Run the given task with the given captured context.

Field Detail

NONEback to summary
public static final ContextHandler<?> NONE

The context handler which captures no context.

Method Detail

captureContextback to summary
public T captureContext()

Capture the current context from the submitting thread.

Returns:T

the captured context

runWithback to summary
public void runWith(Runnable task, T context)

Run the given task with the given captured context. The context should be cleared when this method returns.

Parameters
task:Runnable

the task to run (not null)

context:T

the context returned from captureContext()