@OpenApiAll
public class IdleJobService
extends java.lang.Object
Application decides when it is the most appropriate to execute the job without getting application into an inconsistent state.
Example usage:
Job job = new Job() { public boolean needsExecute() { return true; } public void execute(ProgressStatus progressStatus) throws Exception { // Do necessary work in the session. } public void finished() { // Cleanup after job is finished. } public String getName() { return "My Job"; } }; IdleJobService.getInstance().addJob(job); // Remove the job when it is no longer necessary. IdleJobService.getInstance().removeJob(job); For more information please refer to the JobExample in the examples directory.
Job
Modifier and Type | Method and Description |
---|---|
void |
addJob(Job job)
Adds a job to the service.
|
static IdleJobService |
getInstance()
Gets the singleton job service.
|
void |
removeJob(Job job)
Removes job from the service.
|
public static IdleJobService getInstance()
public void addJob(Job job)
job
- to add to the service.public void removeJob(Job job)
job
- rule to remove