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

All Implemented Interfaces:
    Cloneable, Serializable, Comparable

Direct Known Subclasses:
    SimpleTrigger, UICronTrigger, NthIncludedDayTrigger, CronTrigger

The base abstract class to be extended by all Triggers.

Triggers s have a name and group associated with them, which should uniquely identify them within a single Scheduler .

Triggers are the 'mechanism' by which Job s are scheduled. Many Trigger s can point to the same Job, but a single Trigger can only point to one Job.

Triggers can 'send' parameters/data to Jobs by placing contents into the JobDataMap on the Trigger.

Field Summary
public static final  int INSTRUCTION_NOOP   

Instructs the Scheduler that the Trigger has no further instructions.

 
public static final  int INSTRUCTION_RE_EXECUTE_JOB   

Instructs the Scheduler that the Trigger wants the org.quartz.JobDetail to re-execute immediately. If not in a 'RECOVERING' or 'FAILED_OVER' situation, the execution context will be re-used (giving the Job the abilitiy to 'see' anything placed in the context by its last execution).

 
public static final  int INSTRUCTION_SET_TRIGGER_COMPLETE   

Instructs the Scheduler that the Trigger should be put in the COMPLETE state.

 
public static final  int INSTRUCTION_DELETE_TRIGGER   

Instructs the Scheduler that the Trigger wants itself deleted.

 
public static final  int INSTRUCTION_SET_ALL_JOB_TRIGGERS_COMPLETE   

Instructs the Scheduler that all Trigger s referencing the same org.quartz.JobDetail as this one should be put in the COMPLETE state.

 
public static final  int INSTRUCTION_SET_TRIGGER_ERROR   

Instructs the Scheduler that all Trigger s referencing the same org.quartz.JobDetail as this one should be put in the ERROR state.

 
public static final  int INSTRUCTION_SET_ALL_JOB_TRIGGERS_ERROR   

Instructs the Scheduler that the Trigger should be put in the ERROR state.

 
public static final  int 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.

In order to see if this instruction fits your needs, you should look at the documentation for the getSmartMisfirePolicy() method on the particular Trigger implementation you are using.

 
public static final  int STATE_NORMAL   

Indicates that the Trigger is in the "normal" state.

 
public static final  int STATE_PAUSED   

Indicates that the Trigger is in the "paused" state.

 
public static final  int STATE_COMPLETE   

Indicates that the Trigger is in the "complete" state.

"Complete" indicates that the trigger has not remaining fire-times in its schedule.

 
public static final  int STATE_ERROR   

Indicates that the Trigger is in the "error" state.

A Trigger arrives at the error state when the scheduler attempts to fire it, but cannot due to an error creating and executing its related job. Often this is due to the Job's class not existing in the classpath.

When the trigger is in the error state, the scheduler will make no attempts to fire it.

 
public static final  int STATE_BLOCKED   

Indicates that the Trigger is in the "blocked" state.

A Trigger arrives at the blocked state when the job that it is associated with is a StatefulJob and it is currently executing.

 
public static final  int STATE_NONE   

Indicates that the Trigger does not exist.

 
public static final  int DEFAULT_PRIORITY    The default value for priority. 
Constructor:
 public Trigger() 
 public Trigger(String name,
    String group) 
    Parameters:
    group - if null, Scheduler.DEFAULT_GROUP will be used.
    Throws:
    IllegalArgumentException - if name is null or empty, or the group is an empty string.
    exception: IllegalArgumentException - if name is null or empty, or the group is an empty string.
 public Trigger(String name,
    String group,
    String jobName,
    String jobGroup) 

    Create a Trigger with the given name, and group.

    Parameters:
    group - if null, Scheduler.DEFAULT_GROUP will be used.
    Throws:
    IllegalArgumentException - if name is null or empty, or the group is an empty string.
    exception: IllegalArgumentException - if name is null or empty, or the group is an empty string.
Method from org.quartz.Trigger Summary:
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.Trigger Detail:
 public  void addTriggerListener(String name) 

    Add the specified name of a TriggerListener to the end of the Trigger's list of listeners.

 public  void clearAllTriggerListeners() 
 public Object clone() 
 public int compareTo(Object obj) 

    Compare the next fire time of this Trigger to that of another.

 abstract public Date computeFirstFireTime(Calendar calendar)

    This method should not be used by the Quartz client.

    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 boolean equals(Object obj) 
 abstract public int executionComplete(JobExecutionContext context,
    JobExecutionException result)

    This method should not be used by the Quartz client.

    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 String getCalendarName() 

    Get the name of the Calendar associated with this Trigger.

 public String getDescription() 

    Return the description given to the Trigger instance by its creator (if any).

 abstract public Date getEndTime()

    Get the time at which the Trigger should quit repeating - even if an assigned 'repeatCount' isn't yet satisfied.

 abstract public Date getFinalFireTime()

    Returns the last time at which the Trigger will fire, if the Trigger will repeat indefinitely, null will be returned.

    Note that the return time *may* be in the past.

 public String getFireInstanceId() 

    This method should not be used by the Quartz client.

 abstract public Date getFireTimeAfter(Date afterTime)

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

 public String getFullJobName() 

    Returns the 'full name' of the Job that the Trigger points to, in the format "group.name".

 public String getFullName() 

    Returns the 'full name' of the Trigger in the format "group.name".

 public String getGroup() 

    Get the group of this Trigger.

 public JobDataMap getJobDataMap() 

    Get the JobDataMap that is associated with the Trigger.

    Changes made to this map during job execution are not re-persisted, and in fact typically result in an IllegalStateException.

 public String getJobGroup() 
 public String getJobName() 
 public Key getKey() 
 public int getMisfireInstruction() 

    Get the instruction the Scheduler should be given for handling misfire situations for this Trigger- the concrete Trigger type that you are using will have defined a set of additional MISFIRE_INSTRUCTION_XXX constants that may be passed to this method.

    If not explicitly set, the default value is MISFIRE_INSTRUCTION_SMART_POLICY.

 public String getName() 

    Get the name of this Trigger.

 abstract public Date getNextFireTime()

    Returns the next time at which the Trigger 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.

 abstract public Date getPreviousFireTime()

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

 public int getPriority() 
    The priority of a Trigger acts as a tiebreaker such that if two Triggers have the same scheduled fire time, then the one with the higher priority will get first access to a worker thread.

    If not explicitly set, the default value is 5.

 abstract public Date getStartTime()

    Get the time at which the Trigger should occur.

 public String[] getTriggerListenerNames() 

    Returns an array of String containing the names of all TriggerListener s assigned to the Trigger, in the order in which they should be notified.

 public int hashCode() 
 public boolean isVolatile() 

    Whether or not the Trigger should be persisted in the org.quartz.spi.JobStore for re-use after program restarts.

    If not explicitly set, the default value is false.

 abstract public boolean mayFireAgain()

    Used by the Scheduler to determine whether or not it is possible for this Trigger to fire again.

    If the returned value is false then the Scheduler may remove the Trigger from the org.quartz.spi.JobStore .

 public boolean removeTriggerListener(String name) 

    Remove the specified name of a TriggerListener from the Trigger's list of listeners.

 public  void setCalendarName(String calendarName) 

    Associate the Calendar with the given name with this Trigger.

 public  void setDescription(String description) 

    Set a description for the Trigger instance - may be useful for remembering/displaying the purpose of the trigger, though the description has no meaning to Quartz.

 abstract public  void setEndTime(Date endTime)
 public  void setFireInstanceId(String id) 

    This method should not be used by the Quartz client.

    Usable by org.quartz.spi.JobStore implementations, in order to facilitate 'recognizing' instances of fired Trigger s as their jobs complete execution.

 public  void setGroup(String group) 

    Set the name of this Trigger.

 public  void setJobDataMap(JobDataMap jobDataMap) 

    Set the JobDataMap to be associated with the Trigger.

 public  void setJobGroup(String jobGroup) 
 public  void setJobName(String jobName) 
 public  void setMisfireInstruction(int misfireInstruction) 

    Set the instruction the Scheduler should be given for handling misfire situations for this Trigger- the concrete Trigger type that you are using will have defined a set of additional MISFIRE_INSTRUCTION_XXX constants that may be passed to this method.

    If not explicitly set, the default value is MISFIRE_INSTRUCTION_SMART_POLICY.

 public  void setName(String name) 

    Set the name of this Trigger.

 public  void setPriority(int priority) 
    The priority of a Trigger acts as a tiebreaker such that if two Triggers have the same scheduled fire time, then the one with the higher priority will get first access to a worker thread.

    If not explicitly set, the default value is 5.

 abstract public  void setStartTime(Date startTime)
 public  void setVolatility(boolean volatility) 

    Set whether or not the Trigger should be persisted in the org.quartz.spi.JobStore for re-use after program restarts.

 public String toString() 

    Return a simple string representation of this object.

 abstract public  void triggered(Calendar calendar)

    This method should not be used by the Quartz client.

    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).

 abstract public  void updateAfterMisfire(Calendar cal)

    This method should not be used by the Quartz client.

    To be implemented by the concrete classes that extend this class.

    The implementation should update the Trigger's state based on the MISFIRE_INSTRUCTION_XXX that was selected when the Trigger was created.

 abstract public  void updateWithNewCalendar(Calendar cal,
    long misfireThreshold)

    This method should not be used by the Quartz client.

    To be implemented by the concrete class.

    The implementation should update the Trigger's state based on the given new version of the associated Calendar (the state should be updated so that it's next fire time is appropriate given the Calendar's new settings).

 public  void validate() throws SchedulerException 

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

 abstract protected boolean validateMisfireInstruction(int misfireInstruction)