public abstract class ScheduledTask extends Object
public
no-argument constructor.
A ScheduledTask
is instantiated each time a task definition is validated by EBX®
and each time the execution is fired by the scheduler.
A ScheduledTask
can be parameterized using JavaBean specifications (getters and setters).
Supported parameter types are:
Constructor and Description |
---|
ScheduledTask() |
Modifier and Type | Method and Description |
---|---|
abstract void |
execute(ScheduledExecutionContext aContext)
Executes the current task.
|
void |
handleBeforeInterrupting(ScheduledExecutionContext aContext)
When a task interruption has been requested through EBX® administration,
this method provides the opportunity to perform actions before actually interrupting the task execution.
|
void |
handleBeforePausing(ScheduledExecutionContext aContext)
When a pause has been requested through EBX® administration,
this method provides the opportunity to perform actions before entering the pause state.
|
void |
handleBeforeResuming(ScheduledExecutionContext aContext)
When the administrator requests to resume a paused schedule task, this method provides the opportunity to perform
actions before the task resumes execution.
|
boolean |
isInterruptable()
If
true , the current task can be interrupted
through EBX® administration. |
boolean |
isPausable()
If
true , the current task can be paused
(and resumed) through EBX® administration. |
void |
validate(ValueContextForValidation aValidationContext)
Validates the current task configuration.
|
public void validate(ValueContextForValidation aValidationContext)
Called at:
Default implementation does nothing. To be overridden if specific checks have to be done.
public abstract void execute(ScheduledExecutionContext aContext) throws OperationException, ScheduledTaskInterruption
The implementation of this method should not try to catch the interruption signal
ScheduledTaskInterruption
.
OperationException
ScheduledTaskInterruption
ProgrammaticService
public void handleBeforeInterrupting(ScheduledExecutionContext aContext) throws OperationException
For instance, this may be overridden to release resources by closing open files and database connections.
In order to enable interruptions, the method isInterruptable()
must be overridden.
Also, to allow interrupting, the execution method
must invoke the method ScheduledExecutionContext.handleExecutionState()
where
an interrupt would be acceptable.
Default implementation does nothing.
OperationException
isInterruptable()
,
ScheduledExecutionContext.handleExecutionState()
public void handleBeforePausing(ScheduledExecutionContext aContext) throws OperationException
For instance, this may be overridden to release resources by closing open files and database connections.
In order to enable pauses, the method isPausable()
must be overridden.
Also, to allow pausing, the execution method
must invoke the method ScheduledExecutionContext.handleExecutionState()
where
a pause would be acceptable.
Default implementation does nothing. If an OperationException
is thrown, the task execution is
interrupted.
OperationException
isPausable()
,
ScheduledExecutionContext.handleExecutionState()
public void handleBeforeResuming(ScheduledExecutionContext aContext) throws OperationException
For instance, this may be overridden to acquire resources that were released after the pause by re-opening files and JDBC connections.
If an OperationException
is thrown, the task execution is interrupted.
Default implementation does nothing. To be overridden if a specific behavior is required.
OperationException
handleBeforePausing(ScheduledExecutionContext)
public boolean isInterruptable()
true
, the current task can be interrupted
through EBX® administration.
Default implementation returns false
.
public boolean isPausable()
true
, the current task can be paused
(and resumed) through EBX® administration.
Default implementation returns false
.