Home » quartz-1.6.0 » org » quartz » [javadoc | source]
org.quartz
public class: SimpleTrigger [javadoc | source]
java.lang.Object
   org.quartz.Trigger
      org.quartz.SimpleTrigger

All Implemented Interfaces:
    Cloneable, Serializable, Comparable

A concrete Trigger that is used to fire a org.quartz.JobDetail at a given moment in time, and optionally repeated at a specified interval.

Field Summary
public static final  int MISFIRE_INSTRUCTION_FIRE_NOW   

Instructs the Scheduler that upon a mis-fire situation, the SimpleTrigger wants to be fired now by Scheduler.

NOTE: This instruction should typically only be used for 'one-shot' (non-repeating) Triggers. If it is used on a trigger with a repeat count > 0 then it is equivalent to the instruction #MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNT .

 
public static final  int MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT   

Instructs the Scheduler that upon a mis-fire situation, the SimpleTrigger wants to be re-scheduled to 'now' (even if the associated Calendar excludes 'now') with the repeat count left as-is. This does obey the Trigger end-time however, so if 'now' is after the end-time the Trigger will not fire again.

NOTE: Use of this instruction causes the trigger to 'forget' the start-time and repeat-count that it was originally setup with (this is only an issue if you for some reason wanted to be able to tell what the original values were at some later time).

NOTE: This instruction could cause the Trigger to go to the 'COMPLETE' state after firing 'now', if all the repeat-fire-times where missed.

 
public static final  int MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNT   

Instructs the Scheduler that upon a mis-fire situation, the SimpleTrigger wants to be re-scheduled to 'now' (even if the associated Calendar excludes 'now') with the repeat count set to what it would be, if it had not missed any firings. This does obey the Trigger end-time however, so if 'now' is after the end-time the Trigger will not fire again.

NOTE: Use of this instruction causes the trigger to 'forget' the start-time and repeat-count that it was originally setup with (this is only an issue if you for some reason wanted to be able to tell what the original values were at some later time).

NOTE: This instruction could cause the Trigger to go to the 'COMPLETE' state after firing 'now', if all the repeat-fire-times where missed.

 
public static final  int MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT   

Instructs the Scheduler that upon a mis-fire situation, the SimpleTrigger wants to be re-scheduled to the next scheduled time after 'now' - taking into account any associated Calendar , and with the repeat count set to what it would be, if it had not missed any firings.

NOTE/WARNING: This instruction could cause the Trigger to go directly to the 'COMPLETE' state if all fire-times where missed.

 
public static final  int MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT   

Instructs the Scheduler that upon a mis-fire situation, the SimpleTrigger wants to be re-scheduled to the next scheduled time after 'now' - taking into account any associated Calendar , and with the repeat count left unchanged.

NOTE: Use of this instruction causes the trigger to 'forget' the repeat-count that it was originally setup with (this is only an issue if you for some reason wanted to be able to tell what the original values were at some later time).

NOTE/WARNING: This instruction could cause the Trigger to go directly to the 'COMPLETE' state if all fire-times where missed.

 
public static  int REPEAT_INDEFINITELY   

Used to indicate the 'repeat count' of the trigger is indefinite. Or in other words, the trigger should repeat continually until the trigger's ending timestamp.

 
Fields inherited from org.quartz.Trigger:
INSTRUCTION_NOOP,  INSTRUCTION_RE_EXECUTE_JOB,  INSTRUCTION_SET_TRIGGER_COMPLETE,  INSTRUCTION_DELETE_TRIGGER,  INSTRUCTION_SET_ALL_JOB_TRIGGERS_COMPLETE,  INSTRUCTION_SET_TRIGGER_ERROR,  INSTRUCTION_SET_ALL_JOB_TRIGGERS_ERROR,  MISFIRE_INSTRUCTION_SMART_POLICY,  STATE_NORMAL,  STATE_PAUSED,  STATE_COMPLETE,  STATE_ERROR,  STATE_BLOCKED,  STATE_NONE,  DEFAULT_PRIORITY
Constructor:
 public SimpleTrigger() 
 public SimpleTrigger(String name,
    String group) 

    Create a SimpleTrigger that will occur immediately, and not repeat.

 public SimpleTrigger(String name,
    String group,
    Date startTime) 

    Create a SimpleTrigger that will occur at the given time, and not repeat.

 public SimpleTrigger(String name,
    String group,
    int repeatCount,
    long repeatInterval) 

    Create a SimpleTrigger that will occur immediately, and repeat at the the given interval the given number of times.

 public SimpleTrigger(String name,
    String group,
    Date startTime,
    Date endTime,
    int repeatCount,
    long repeatInterval) 

    Create a SimpleTrigger that will occur at the given time, and repeat at the the given interval the given number of times, or until the given end time.

    Parameters:
    startTime - A Date set to the time for the Trigger to fire.
    endTime - A Date set to the time for the Trigger to quit repeat firing.
    repeatCount - The number of times for the Trigger to repeat firing, use #REPEAT_INDEFINITELY for unlimitted times.
    repeatInterval - The number of milliseconds to pause between the repeat firing.
 public SimpleTrigger(String name,
    String group,
    String jobName,
    String jobGroup,
    Date startTime,
    Date endTime,
    int repeatCount,
    long repeatInterval) 

    Create a SimpleTrigger that will occur at the given time, fire the identified Job and repeat at the the given interval the given number of times, or until the given end time.

    Parameters:
    startTime - A Date set to the time for the Trigger to fire.
    endTime - A Date set to the time for the Trigger to quit repeat firing.
    repeatCount - The number of times for the Trigger to repeat firing, use #REPEAT_INDEFINITELY for unlimitted times.
    repeatInterval - The number of milliseconds to pause between the repeat firing.
Method from org.quartz.SimpleTrigger Summary:
computeFirstFireTime,   computeNumTimesFiredBetween,   executionComplete,   getEndTime,   getFinalFireTime,   getFireTimeAfter,   getFireTimeBefore,   getNextFireTime,   getPreviousFireTime,   getRepeatCount,   getRepeatInterval,   getStartTime,   getTimesTriggered,   main,   mayFireAgain,   setEndTime,   setNextFireTime,   setPreviousFireTime,   setRepeatCount,   setRepeatInterval,   setStartTime,   setTimesTriggered,   triggered,   updateAfterMisfire,   updateWithNewCalendar,   validate,   validateMisfireInstruction
Methods from org.quartz.Trigger:
addTriggerListener,   clearAllTriggerListeners,   clone,   compareTo,   computeFirstFireTime,   equals,   executionComplete,   getCalendarName,   getDescription,   getEndTime,   getFinalFireTime,   getFireInstanceId,   getFireTimeAfter,   getFullJobName,   getFullName,   getGroup,   getJobDataMap,   getJobGroup,   getJobName,   getKey,   getMisfireInstruction,   getName,   getNextFireTime,   getPreviousFireTime,   getPriority,   getStartTime,   getTriggerListenerNames,   hashCode,   isVolatile,   mayFireAgain,   removeTriggerListener,   setCalendarName,   setDescription,   setEndTime,   setFireInstanceId,   setGroup,   setJobDataMap,   setJobGroup,   setJobName,   setMisfireInstruction,   setName,   setPriority,   setStartTime,   setVolatility,   toString,   triggered,   updateAfterMisfire,   updateWithNewCalendar,   validate,   validateMisfireInstruction
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.quartz.SimpleTrigger Detail:
 public Date computeFirstFireTime(Calendar calendar) 

    Called by the scheduler at the time a Trigger is first added to the scheduler, in order to have the Trigger compute its first fire time, based on any associated calendar.

    After this method has been called, getNextFireTime() should return a valid answer.

 public int computeNumTimesFiredBetween(Date start,
    Date end) 
 public int executionComplete(JobExecutionContext context,
    JobExecutionException result) 

    Called after the Scheduler has executed the org.quartz.JobDetail associated with the Trigger in order to get the final instruction code from the trigger.

 public Date getEndTime() 

    Get the time at which the SimpleTrigger should quit repeating - even if repeastCount isn't yet satisfied.

 public Date getFinalFireTime() 

    Returns the final time at which the SimpleTrigger will fire, if repeatCount is REPEAT_INDEFINITELY, null will be returned.

    Note that the return time may be in the past.

 public Date getFireTimeAfter(Date afterTime) 

    Returns the next time at which the SimpleTrigger will fire, after the given time. If the trigger will not fire after the given time, null will be returned.

 public Date getFireTimeBefore(Date end) 

    Returns the last time at which the SimpleTrigger will fire, before the given time. If the trigger will not fire before the given time, null will be returned.

 public Date getNextFireTime() 

    Returns the next time at which the SimpleTrigger will fire. If the trigger will not fire again, null will be returned. The value returned is not guaranteed to be valid until after the Trigger has been added to the scheduler.

 public Date getPreviousFireTime() 

    Returns the previous time at which the SimpleTrigger will fire. If the trigger has not yet fired, null will be returned.

 public int getRepeatCount() 

    Get the the number of times the SimpleTrigger should repeat, after which it will be automatically deleted.

 public long getRepeatInterval() 

    Get the the time interval (in milliseconds) at which the SimpleTrigger should repeat.

 public Date getStartTime() 

    Get the time at which the SimpleTrigger should occur.

 public int getTimesTriggered() 

    Get the number of times the SimpleTrigger has already fired.

 public static  void main(String[] args) throws Exception 
 public boolean mayFireAgain() 

    Determines whether or not the SimpleTrigger will occur again.

 public  void setEndTime(Date endTime) 

    Set the time at which the SimpleTrigger should quit repeating (and be automatically deleted).

 public  void setNextFireTime(Date nextFireTime) 

    Set the next time at which the SimpleTrigger should fire.

    This method should not be invoked by client code.

 public  void setPreviousFireTime(Date previousFireTime) 

    Set the previous time at which the SimpleTrigger fired.

    This method should not be invoked by client code.

 public  void setRepeatCount(int repeatCount) 

    Set the the number of time the SimpleTrigger should repeat, after which it will be automatically deleted.

 public  void setRepeatInterval(long repeatInterval) 

    Set the the time interval (in milliseconds) at which the SimpleTrigger should repeat.

 public  void setStartTime(Date startTime) 

    Set the time at which the SimpleTrigger should occur.

 public  void setTimesTriggered(int timesTriggered) 

    Set the number of times the SimpleTrigger has already fired.

 public  void triggered(Calendar calendar) 

    Called when the Scheduler has decided to 'fire' the trigger (execute the associated Job), in order to give the Trigger a chance to update itself for its next triggering (if any).

 public  void updateAfterMisfire(Calendar cal) 

    Updates the SimpleTrigger's state based on the MISFIRE_INSTRUCTION_XXX that was selected when the SimpleTrigger was created.

    If the misfire instruction is set to MISFIRE_INSTRUCTION_SMART_POLICY, then the following scheme will be used:

    • If the Repeat Count is 0, then the instruction will be interpreted as MISFIRE_INSTRUCTION_FIRE_NOW.
    • If the Repeat Count is REPEAT_INDEFINITELY, then the instruction will be interpreted as MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT. WARNING: using MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT with a trigger that has a non-null end-time may cause the trigger to never fire again if the end-time arrived during the misfire time span.
    • If the Repeat Count is > 0, then the instruction will be interpreted as MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT.

 public  void updateWithNewCalendar(Calendar calendar,
    long misfireThreshold) 
 public  void validate() throws SchedulerException 

    Validates whether the properties of the JobDetail are valid for submission into a Scheduler.

 protected boolean validateMisfireInstruction(int misfireInstruction)