Thursday 30 October 2014

Trigger interface


A job is an executable task that can be scheduled. A trigger provides a schedule for the job. Quartz ships with number of triggers like below.

CalendarIntervalTrigger
CoreTrigger
CronTrigger
DailyTimeIntervalTrigger
MutableTrigger
OperableTrigger
SimpleTrigger

All the above interfaces extends Trigger interface. Most commonly used triggers are SimpleTrigger and CronTrigger.

Fields in Trigger interface
Field
Description
DEFAULT_PRIORITY
Sets default priority to this trigger. Default is 5. Priorities only compared when triggers have the same fire time. A trigger scheduled to fire at 11.05 will always schedule before one scheduled at 11.06.
MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY
Instructs the Scheduler that the Trigger will never be evaluated for a misfire situation, and that the scheduler will simply try to fire it as soon as it can, and then update the Trigger as if it had fired at the proper time.
MISFIRE_INSTRUCTION_SMART_POLICY
Instructs the Scheduler that upon a mis-fire situation, the updateAfterMisfire() method will be called on the Trigger to determine the mis-fire instruction, which logic will be trigger-implementation-dependent.


Note:
A misfire occurs if a trigger misses its firing time since the scheduler may shutdown or there are no available threads in Quarz thread pool for executing this job.

Prevoius                                                 Next                                                 Home

No comments:

Post a Comment