Abstract base representation of a cron4j task.
Developers can extends this abstract class to build their own tasks.
Extending Task means, above all, implementing the {@link Task#execute(TaskExecutionContext)} method. Within this method thetask must perform its operation. If the execute() method returns regularly then the execution is considered to be successfully completed. If execute() dies throwing a {@link RuntimeException} then the taskexecution is considered to be failed. The supplied parameter, which is a {@link TaskExecutionContext} instance, helps the developer in integrating histask with the scheduler executor. Through the context the developer can check if the execution has been paused or stopped, and he can also push back some status informations by calling {@link TaskExecutionContext#setCompleteness(double)} and{@link TaskExecutionContext#setStatusMessage(String)}.
If the custom task supports pausing, stopping and/or tracking, that should be notified by overriding {@link Task#canBePaused()}, {@link Task#canBeStopped()}, {@link Task#supportsCompletenessTracking()}and/or {@link Task#supportsStatusTracking()}.
@author Carlo Pelliccia @since 2.0
|
|