Package com.apple.foundationdb.async
Class TaskNotifyingExecutor
- java.lang.Object
-
- com.apple.foundationdb.async.TaskNotifyingExecutor
-
- All Implemented Interfaces:
Executor
@API(EXPERIMENTAL) public abstract class TaskNotifyingExecutor extends Object implements Executor
An executor that can perform pre- and post- work in the context of the thread executing a task. A typical use for this executor is to perform actions such as setting up and tearing down thread local variables that need to be present for code that is executed within the tasks.
-
-
Constructor Summary
Constructors Constructor Description TaskNotifyingExecutor(Executor executor)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
afterTask()
Called in the context of an executor thread, immediately after a task has completed execution (either successfully or with error).abstract void
beforeTask()
Called in the context of an executor thread, immediately prior to actually executing a task.void
execute(Runnable task)
-
-
-
Method Detail
-
beforeTask
public abstract void beforeTask()
Called in the context of an executor thread, immediately prior to actually executing a task. Exceptions thrown from this method will prevent the execution of the task itself, however theafterTask()
will still be executed.
-
afterTask
public abstract void afterTask()
Called in the context of an executor thread, immediately after a task has completed execution (either successfully or with error). Exceptions thrown from this will cause the task to be treated as a failure and will mask any exception that the task may have produced.
-
-