org.quartz.examples
Class InterruptableJobTest

java.lang.Object
  extended byorg.quartz.examples.InterruptableJobTest

public class InterruptableJobTest
extends java.lang.Object

Demonstrates the behavior of StatefulJobs, as well as how misfire instructions affect the firings of triggers of StatefulJob s - when the jobs take longer to execute that the frequency of the trigger's repitition.

While the example is running, you should note that there are two triggers with identical schedules, firing identical jobs. The triggers "want" to fire every 3 seconds, but the jobs take 10 seconds to execute. Therefore, by the time the jobs complete their execution, the triggers have already "misfired" (unless the scheduler's "misfire threshold" has been set to more than 7 seconds). You should see that one of the jobs has its misfire instruction set to SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT- which causes it to fire immediately, when the misfire is detected. The other trigger uses the default "smart policy" misfire instruction, which causes the trigger to advance to its next fire time (skipping those that it has missed) - so that it does not refire immediately, but rather at the next scheduled time.

Author:
Chris Bonham

Constructor Summary
InterruptableJobTest()
           
 
Method Summary
static void main(java.lang.String[] args)
           
static void schedTest(SchedulerFactory sf)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InterruptableJobTest

public InterruptableJobTest()
Method Detail

schedTest

public static void schedTest(SchedulerFactory sf)
                      throws java.lang.Exception
Throws:
java.lang.Exception

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception

Quartz Project Page