IMPLTYPE - Implementation typepublic abstract class AbstractTrigger<IMPLTYPE extends AbstractTrigger<IMPLTYPE>> extends Object implements IOperableTrigger, com.helger.commons.lang.ICloneable<IMPLTYPE>
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
.
IScheduler
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.
ITrigger.ECompletedExecutionInstruction, ITrigger.EMisfireInstruction, ITrigger.ETriggerStateDEFAULT_PRIORITY| Modifier | Constructor and Description |
|---|---|
|
AbstractTrigger()
Create a
Trigger with no specified name, group, or
. |
protected |
AbstractTrigger(AbstractTrigger<IMPLTYPE> aOther)
Copy constructor
|
|
AbstractTrigger(String name)
Create a
Trigger with the given name, and default group. |
|
AbstractTrigger(String name,
String group)
Create a
Trigger with the given name, and group. |
|
AbstractTrigger(String name,
String group,
String jobName,
String jobGroup)
Create a
Trigger with the given name, and group. |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(ITrigger aOther)
Compare the next fire time of this
Trigger to that of another
by comparing their keys, or in other words, sorts them according to the
natural (i.e. alphabetical) order of their keys. |
boolean |
equals(Object o)
Trigger equality is based upon the equality of the TriggerKey.
|
ITrigger.ECompletedExecutionInstruction |
executionComplete(IJobExecutionContext context,
JobExecutionException result)
This method should not be used by the Quartz client.
|
String |
getCalendarName()
Get the name of the
associated with this
Trigger. |
String |
getDescription()
Return the description given to the
Trigger instance by its
creator (if any). |
String |
getFireInstanceId()
This method should not be used by the Quartz client.
|
String |
getFullJobName()
Returns the 'full name' of the
Job that the
Trigger points to, in the format "group.name". |
String |
getFullName()
Returns the 'full name' of the
Trigger in the format
"group.name". |
String |
getGroup()
Get the group of this
Trigger. |
JobDataMap |
getJobDataMap()
Get the
JobDataMap that is associated with the
Trigger. |
String |
getJobGroup()
Get the name of the associated
's group. |
JobKey |
getJobKey() |
String |
getJobName()
Get the name of the associated
. |
TriggerKey |
getKey() |
ITrigger.EMisfireInstruction |
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 set
as this property's value. |
String |
getName()
Get the name of this
Trigger. |
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. |
abstract IScheduleBuilder<IMPLTYPE> |
getScheduleBuilder()
Get a
IScheduleBuilder that is configured to produce a schedule
identical to this trigger's schedule. |
TriggerBuilder<IMPLTYPE> |
getTriggerBuilder()
Get a
TriggerBuilder that is configured to produce a
Trigger identical to this one. |
int |
hashCode() |
void |
setCalendarName(String sCalendarName)
Associate the
Calendar with the given name with this Trigger. |
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. |
void |
setFireInstanceId(String id)
This method should not be used by the Quartz client.
|
void |
setGroup(String group)
Set the name of this
Trigger. |
void |
setJobDataMap(JobDataMap jobDataMap)
Set the
JobDataMap to be associated with the
Trigger. |
void |
setJobGroup(String jobGroup)
Set the name of the associated
's group. |
void |
setJobKey(JobKey key) |
void |
setJobName(String jobName)
Set the name of the associated
. |
void |
setKey(TriggerKey key) |
void |
setMisfireInstruction(ITrigger.EMisfireInstruction 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. |
void |
setName(String name)
Set the name of this
Trigger. |
void |
setPriority(int priority)
The priority of a
Trigger acts as a tie breaker such that if
two Triggers have the same scheduled fire time, then Quartz
will do its best to give the one with the higher priority first access to a
worker thread. |
String |
toString()
Return a simple string representation of this object.
|
void |
validate()
Validates whether the properties of the
JobDetail are valid
for submission into a Scheduler. |
protected abstract boolean |
validateMisfireInstruction(ITrigger.EMisfireInstruction candidateMisfireInstruction) |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitcomputeFirstFireTime, getClone, setNextFireTime, setPreviousFireTime, triggered, updateAfterMisfire, updateWithNewCalendarsetEndTime, setStartTimegetEndTime, getFinalFireTime, getFireTimeAfter, getNextFireTime, getPreviousFireTime, getStartTime, mayFireAgainprotected AbstractTrigger(@Nonnull AbstractTrigger<IMPLTYPE> aOther)
aOther - Calendar to copy from. May not be null.public AbstractTrigger()
Create a Trigger with no specified name, group, or
.
IJobDetail
Note that the setName(String),setGroup(String)and the
setJobName(String)and setJobGroup(String)methods must be
called before the Trigger can be placed into a
IScheduler.
public AbstractTrigger(String name)
Create a Trigger with the given name, and default group.
Note that the setJobName(String)and
setJobGroup(String)methods must be called before the
Trigger can be placed into a IScheduler.
IllegalArgumentException - if name is null or empty, or the group is an empty string.public AbstractTrigger(String name, String group)
Create a Trigger with the given name, and group.
Note that the setJobName(String)and
setJobGroup(String)methods must be called before the
Trigger can be placed into a IScheduler.
group - if null, Scheduler.DEFAULT_GROUP will be used.IllegalArgumentException - if name is null or empty, or the group is an empty string.public AbstractTrigger(String name, String group, String jobName, String jobGroup)
Create a Trigger with the given name, and group.
group - if null, Scheduler.DEFAULT_GROUP will be used.IllegalArgumentException - if name is null or empty, or the group is an empty string.public final String getName()
Trigger.public final void setName(@Nonnull String name)
Set the name of this Trigger.
IllegalArgumentException - if name is null or empty.public final String getGroup()
Trigger.public final void setGroup(@Nullable String group)
Trigger.group - if null, Scheduler.DEFAULT_GROUP will be used.IllegalArgumentException - if group is an empty string.public final void setKey(@Nonnull TriggerKey key)
setKey in interface IMutableTriggerpublic final String getJobName()
Get the name of the associated
.
IJobDetail
public final void setJobName(@Nonnull String jobName)
Set the name of the associated
.
IJobDetail
IllegalArgumentException - if jobName is null or empty.public final String getJobGroup()
Get the name of the associated
's group.
IJobDetail
public final void setJobGroup(@Nullable String jobGroup)
Set the name of the associated
's group.
IJobDetail
jobGroup - if null, Scheduler.DEFAULT_GROUP will be used.IllegalArgumentException - if group is an empty string.public final void setJobKey(@Nonnull JobKey key)
setJobKey in interface IMutableTrigger@Nonnull public final String getFullName()
Trigger in the format
"group.name".@Nullable public final TriggerKey getKey()
@Nonnull public final String getFullJobName()
Job that the
Trigger points to, in the format "group.name".@Nullable public final String getDescription()
ITriggerTrigger instance by its
creator (if any).getDescription in interface ITriggernull if no description was set.public final void setDescription(@Nullable String description)
IMutableTriggerTrigger instance - may be useful for
remembering/displaying the purpose of the trigger, though the description
has no meaning to Quartz.setDescription in interface IMutableTrigger@Nullable public final String getCalendarName()
ITriggerICalendar associated with this
Trigger.getCalendarName in interface ITriggernull if there is no associated Calendar.public final void setCalendarName(@Nullable String sCalendarName)
IMutableTriggerCalendar with the given name with this Trigger.setCalendarName in interface IMutableTriggersCalendarName - use null to dis-associate a Calendar.@Nonnull public final JobDataMap getJobDataMap()
ITriggerJobDataMap that is associated with the
Trigger.IllegalStateException.getJobDataMap in interface ITriggerpublic final void setJobDataMap(@Nullable JobDataMap jobDataMap)
IMutableTriggerJobDataMap to be associated with the
Trigger.setJobDataMap in interface IMutableTriggerjobDataMap - The new job data map. May be null.public final int getPriority()
ITriggerTrigger 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.5.getPriority in interface ITriggerITrigger.DEFAULT_PRIORITYpublic final void setPriority(int priority)
IMutableTriggerTrigger acts as a tie breaker such that if
two Triggers have the same scheduled fire time, then Quartz
will do its best to give the one with the higher priority first access to a
worker thread.5.setPriority in interface IMutableTriggerITrigger.DEFAULT_PRIORITY@Nonnull public ITrigger.ECompletedExecutionInstruction executionComplete(IJobExecutionContext context, @Nullable JobExecutionException result)
IScheduler has executed the
IJobDetail associated with the
Trigger in order to get the final instruction code from the
trigger.executionComplete in interface IOperableTriggercontext - is the JobExecutionContext that was used by the
Job'sexecute(xx) method.result - is the JobExecutionException thrown by the
Job, if any (may be null).ITrigger.ECompletedExecutionInstruction,
IOperableTrigger.triggered(ICalendar)public final ITrigger.EMisfireInstruction getMisfireInstruction()
ITriggerScheduler 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 set
as this property's value.
If not explicitly set, the default value is
MISFIRE_INSTRUCTION_SMART_POLICY.
getMisfireInstruction in interface ITriggerISimpleTrigger,
ICronTriggerpublic final void setMisfireInstruction(ITrigger.EMisfireInstruction misfireInstruction)
IMutableTriggerScheduler 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.MISFIRE_INSTRUCTION_SMART_POLICY.setMisfireInstruction in interface IMutableTriggerIOperableTrigger.updateAfterMisfire(com.helger.quartz.ICalendar),
ISimpleTrigger,
ICronTriggerprotected abstract boolean validateMisfireInstruction(ITrigger.EMisfireInstruction candidateMisfireInstruction)
public void validate()
throws SchedulerException
Validates whether the properties of the JobDetail are valid
for submission into a Scheduler.
validate in interface IOperableTriggerIllegalStateException - if a required property (such as Name, Group, Class) is not set.SchedulerException@Nullable public final String getFireInstanceId()
IOperableTriggergetFireInstanceId in interface IOperableTriggerpublic final void setFireInstanceId(@Nullable String id)
IOperableTriggerIJobStore
implementations, in order to facilitate 'recognizing' instances of fired
Trigger s as their jobs complete execution.setFireInstanceId in interface IOperableTriggerpublic String toString()
Return a simple string representation of this object.
public int compareTo(@Nonnull ITrigger aOther)
Compare the next fire time of this Trigger to that of another
by comparing their keys, or in other words, sorts them according to the
natural (i.e. alphabetical) order of their keys.
compareTo in interface ITriggercompareTo in interface Comparable<ITrigger>public boolean equals(Object o)
@Nonnull public TriggerBuilder<IMPLTYPE> getTriggerBuilder()
ITriggerTriggerBuilder that is configured to produce a
Trigger identical to this one.getTriggerBuilder in interface ITriggerITrigger.getScheduleBuilder()@Nonnull public abstract IScheduleBuilder<IMPLTYPE> getScheduleBuilder()
ITriggerIScheduleBuilder that is configured to produce a schedule
identical to this trigger's schedule.getScheduleBuilder in interface ITriggerITrigger.getTriggerBuilder()Copyright © 2016–2021 Philip Helger. All rights reserved.