http://blog.csdn.net/zhuce0001/article/details/53239628
// Stateful job1 runs every 3 seconds, but with a 10-second delay (10 seconds of sleep in the task simulates 10 seconds to execute the task) JobDetail job = newJob(StatefulDumbJob.class).withIdentity( "statefulJob1", "group1").usingJobData( StatefulDumbJob.EXECUTION_DELAY, 10000L).build(); SimpleTrigger trigger = newTrigger().withIdentity("trigger1", "group1") .startAt (startTime) .withSchedule ( simpleSchedule().withIntervalInSeconds(3) .repeatForever()).build(); Date ft = sched.scheduleJob(job, trigger); log.info(job.getKey() + " will run at: " + ft + " and repeat: " + trigger.getRepeatCount() + " times, every " + trigger.getRepeatInterval () / 1000 + "seconds"); // Stateful job2 runs every 3 seconds, but with a 10-second delay (10 seconds of sleep in the task simulates 10 seconds of task execution) // job2 has a policy set, so it will fire immediately after a miss, without waiting for the next trigger point job = newJob(StatefulDumbJob.class).withIdentity("statefulJob2", "group1").usingJobData(StatefulDumbJob.EXECUTION_DELAY, 10000L) .build(); trigger = newTrigger().withIdentity("trigger2", "group1").startAt( startTime).withSchedule( simpleSchedule().withIntervalInSeconds(3).repeatForever() // Set the scheduling policy after the missed trigger .withMisfireHandlingInstructionNowWithExistingCount()) .build(); ft = sched.scheduleJob(job, trigger);