org.quartz.examples.example5
Class MisfireExample

java.lang.Object
  extended by org.quartz.examples.example5.MisfireExample

public class MisfireExample
extends 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
MisfireExample()
           
 
Method Summary
static void main(String[] args)
           
 void run()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MisfireExample

public MisfireExample()
Method Detail

run

public void run()
         throws Exception
Throws:
Exception

main

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


Copyright © 2010. All Rights Reserved.