public interface TaskWrapper
TaskWrapper
is a facility to wrap Runnable
background tasks before they are passed to the
Executor
. Use-cases include injection of thread-local context variables, or more fine-granular error
handling.
All sub-queries sent by the federation engine that make use of the concurrency infrastructure (e.g.
ControlledWorkerScheduler
) are passing this wrapper.
The concrete implementation can be configured using FedXConfig.withTaskWrapper(TaskWrapper)
.
ControlledWorkerScheduler
,
FedXConfig.withTaskWrapper(TaskWrapper)
Modifier and Type | Method and Description |
---|---|
<T> Callable<T> |
wrap(Callable<T> callable)
Wrap the given
Callable and add custom logic. |
Runnable |
wrap(Runnable runnable)
Wrap the given
Runnable and add custom logic. |
Runnable wrap(Runnable runnable)
Runnable
and add custom logic.
Use cases include injection of state into the thread-local context, or more fine granular error handling.
Note that when modifying state in ThreadLocal
it must be reset properly in a try/finally block.
runnable
- the task as generated by the FedX engineRunnable
<T> Callable<T> wrap(Callable<T> callable)
Callable
and add custom logic.
Use cases include injection of state into the thread-local context, or more fine granular error handling.
Note that when modifying state in ThreadLocal
it must be reset properly in a try/finally block.
callable
- the task as generated by the FedX engineCallable
Copyright © 2015-2020 Eclipse Foundation. All Rights Reserved.