org.quartz.examples.example13
public class: SimpleRecoveryJob [javadoc |
source]
java.lang.Object
org.quartz.examples.example13.SimpleRecoveryJob
All Implemented Interfaces:
Job
Direct Known Subclasses:
SimpleRecoveryStatefulJob
A dumb implementation of Job, for unittesting purposes.
| Constructor: |
public SimpleRecoveryJob() {
}
Quartz requires a public empty constructor so that the
scheduler can instantiate the class whenever it needs. |
| Method from org.quartz.examples.example13.SimpleRecoveryJob Summary: |
|---|
|
execute |
| Method from org.quartz.examples.example13.SimpleRecoveryJob Detail: |
public void execute(JobExecutionContext context) throws JobExecutionException {
String jobName = context.getJobDetail().getFullName();
// if the job is recovering print a message
if (context.isRecovering()) {
_log.info("SimpleRecoveryJob: " + jobName + " RECOVERING at " + new Date());
} else {
_log.info("SimpleRecoveryJob: " + jobName + " starting at " + new Date());
}
// delay for ten seconds
long delay = 10L * 1000L;
try {
Thread.sleep(delay);
} catch (Exception e) {
}
JobDataMap data = context.getJobDetail().getJobDataMap();
int count;
if (data.containsKey(COUNT)) {
count = data.getInt(COUNT);
} else {
count = 0;
}
count++;
data.put(COUNT, count);
_log.info("SimpleRecoveryJob: " + jobName +
" done at " + new Date() +
"\n Execution #" + count);
}
|