Database Reference
In-Depth Information
you must implement the following job naming, defined in org.exist.schedu
ler.JobDescription :
/**
* Set the name of the job.
* After being set, the job should return this name.
*
* @param name The job's new name
*/
public String getName ();
/**
* Get the name of the job.
* If a name has not yet been set, you must create one!
*
* @return The job's name
*/
public void setName ( final String name );
These functions simply round-trip the name of the job. The job's name itself must be
unique across all job instances. For Java jobs, you simply need to create an initial
name and then return that each time get is called, or store the incoming name when
set is called and then return that.
You also need to provide the actual work of the job in the form of implementing the
abstract function defined in org.exist.scheduler.UserJavaJob :
/**
* The actual work/task of the scheduled job.
* This function is called each time the job is executed by the scheduler
* according to its schedule.
*
* @param brokerpool The database BrokerPool.
* @param params Any parameters passed to the job, or null otherwise.
*
* @throws JobException You may throw a JobException to control the
* cleanup of the job and affect rescheduling in case of a problem.
*/
public abstract void execute ( BrokerPool brokerpool , Map < String , ?> params )
throws JobException ;
When your code is executing, should you encounter a problem or exception, you
must catch it, and if you wish to end processing you may throw an org.exist.sched
uler.JobException . The JobException class takes an enumerated value of type
org.exist.scheduler.JobException.JobExceptionAction , which controls how the
job is aborted by the scheduler and whether its schedule should be adjusted. The
available job exception actions when aborting a running job are outlined in
Table 16-2 .
Search WWH ::




Custom Search