|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The interface to be implemented by
that provide a
mechanism for having their execution interrupted. It is NOT a requirment
for jobs to implement this interface - in fact, for most people, none of
their jobs will.
Job
s
The means of actually interrupting the Job must be implemented within the
Job
itself (the interrupt()
method of this
interface is simply a means for the scheduler to inform the Job
that a request has been made for it to be interrupted). The mechanism that
your jobs use to interrupt themselves might vary between implementations.
However the principle idea in any implementation should be to have the
body of the job's execute(..)
periodically check some flag to
see if an interruption has been requested, and if the flag is set, somehow
abort the performance of the rest of the job's work. An example of
interrupting a job can be found in the java source for the class
org.quartz.examples.DumbInterruptableJob
. It is legal to use
some combination of wait()
and notify()
synchronization within interrupt()
and execute(..)
in order to have the interrupt()
method block until the
execute(..)
signals that it has noticed the set flag.
Job
,
StatefulJob
,
Scheduler.interrupt(String, String)
,
DumbInterruptableJob
Method Summary | |
void |
interrupt()
Called by the when a user
interrupts the Job . |
Methods inherited from interface org.quartz.Job |
execute |
Method Detail |
public void interrupt() throws UnableToInterruptJobException
Called by the
when a user
interrupts the Scheduler
Job
.
UnableToInterruptJobException
- if there is an exception while interrupting the job.
|
Quartz Project Page | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |