public interface ReportingExecutorService
ExecutorServices that makes them call a
"reporting" method whenever an important event occurs.ExecutorServices can "hook" into these
events by overriding the specific method and add additional logic like logging or debugging capabilities.| Modifier and Type | Method and Description |
|---|---|
void |
onCancelTask(TaskDetails taskDetails)
This method gets called whenever a task is cancelled through its
Future or through
the shutdown methods of the ExecutorService.It only gets called once for every task. |
void |
onCompleteTask(TaskDetails taskDetails,
Throwable error)
This method gets called whenever a task completes.
This can be through either raising an exception, cancelling from the outside or by simply terminating in a normal manner. |
void |
onFinishTask(TaskDetails taskDetails,
Throwable error)
This method gets called whenever a task is finished.
For recurring tasks it is called multiple times. |
void |
onScheduleTask(TaskDetails taskDetails)
This method gets called whenever a new task is scheduled to run.
In contrast to onStartTask(TaskDetails) this method gets called only once for "recurring" tasks that are
scheduled to run in pre-defined intervals. |
void |
onStartTask(TaskDetails taskDetails)
This method gets called whenever a task is started.
For recurring tasks it is called multiple times. |
void onScheduleTask(TaskDetails taskDetails)
onStartTask(TaskDetails) this method gets called only once for "recurring" tasks that are
scheduled to run in pre-defined intervals.taskDetails - object containing details about this taskvoid onStartTask(TaskDetails taskDetails)
taskDetails - object containing details about this taskvoid onFinishTask(TaskDetails taskDetails, Throwable error)
taskDetails - object containing details about this taskerror - Exception that caused the task to completevoid onCancelTask(TaskDetails taskDetails)
Future or through
the shutdown methods of the ExecutorService.taskDetails - object containing details about this taskvoid onCompleteTask(TaskDetails taskDetails, Throwable error)
taskDetails - object containing details about this taskerror - Exception that caused the task to completeCopyright © 2019. All rights reserved.