IInterruptableJob InterfaceQuartz.NET API Documentation
The interface to be implemented by IJobs that provide a mechanism for having their execution interrupted. It is NOT a requirement for jobs to implement this interface - in fact, for most people, none of their jobs will.

Namespace: Quartz
Assembly: Quartz (in Quartz.dll) Version: 2.2.1.400
Syntax

public interface IInterruptableJob : IJob
Remarks

The means of actually interrupting the Job must be implemented within the IJob itself (the Interrupt  method of this interface is simply a means for the scheduler to inform the IJob 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(IJobExecutionContext) 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 source for the class Example7's DumbInterruptableJob It is legal to use some combination of Wait(Object) and Pulse(Object) synchronization within Interrupt  and Execute(IJobExecutionContext) in order to have the Interrupt  method block until the Execute(IJobExecutionContext) signals that it has noticed the set flag.

If the Job performs some form of blocking I/O or similar functions, you may want to consider having the Execute(IJobExecutionContext) method store a reference to the calling Thread as a member variable. Then the implementation of this interfaces Interrupt  method can call Interrupt  on that Thread. Before attempting this, make sure that you fully understand what Interrupt  does and doesn't do. Also make sure that you clear the Job's member reference to the Thread when the Execute(..) method exits (preferably in a finally block.

See Also