public class SimpleTrigger extends AbstractTrigger<SimpleTrigger> implements ISimpleTrigger
A concrete that is used to
fire a ITrigger at a given moment in
time, and optionally repeated at a specified interval.
IJobDetail
ITrigger,
ICronTrigger,
TriggerUtilsITrigger.ECompletedExecutionInstruction, ITrigger.EMisfireInstruction, ITrigger.ETriggerStateREPEAT_INDEFINITELYDEFAULT_PRIORITY| Constructor and Description |
|---|
SimpleTrigger()
Create a
SimpleTrigger with no settings. |
SimpleTrigger(SimpleTrigger aOther) |
| Modifier and Type | Method and Description |
|---|---|
Date |
computeFirstFireTime(ICalendar 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. |
int |
computeNumTimesFiredBetween(Date start,
Date end) |
static SimpleTrigger |
create(String name,
String group,
String jobName,
String jobGroup,
Date startTime,
Date endTime,
int repeatCount,
long repeatInterval) |
boolean |
equals(Object o)
Trigger equality is based upon the equality of the TriggerKey.
|
SimpleTrigger |
getClone() |
Date |
getEndTime()
Get the time at which the
Trigger should quit repeating -
regardless of any remaining repeats (based on the trigger's particular
repeat settings). |
Date |
getFinalFireTime()
Returns the final time at which the
SimpleTrigger will fire,
if repeatCount is REPEAT_INDEFINITELY, null will be returned. |
Date |
getFireTimeAfter(Date aAfterTime)
Returns the next time at which the
SimpleTrigger will fire,
after the given time. |
Date |
getFireTimeBefore(Date end)
Returns the last time at which the
SimpleTrigger will fire,
before the given time. |
Date |
getNextFireTime()
Returns the next time at which the
Trigger is scheduled to
fire. |
Date |
getPreviousFireTime()
Returns the previous time at which the
SimpleTrigger fired. |
int |
getRepeatCount()
Get the the number of times the
SimpleTrigger should repeat,
after which it will be automatically deleted. |
long |
getRepeatInterval()
Get the the time interval (in milliseconds) at which the
SimpleTrigger should repeat. |
IScheduleBuilder<SimpleTrigger> |
getScheduleBuilder()
Get a
IScheduleBuilder that is configured to produce a schedule
identical to this trigger's schedule. |
Date |
getStartTime()
Get the time at which the
Trigger should occur. |
int |
getTimesTriggered()
Get the number of times the
SimpleTrigger has already fired. |
int |
hashCode() |
boolean |
mayFireAgain()
Determines whether or not the
SimpleTrigger will occur again. |
void |
setEndTime(Date endTime)
Set the time at which the
Trigger should quit repeating -
regardless of any remaining repeats (based on the trigger's particular
repeat settings). |
void |
setNextFireTime(Date nextFireTime)
Set the next time at which the
SimpleTrigger should fire. |
void |
setPreviousFireTime(Date previousFireTime)
Set the previous time at which the
SimpleTrigger fired. |
void |
setRepeatCount(int repeatCount)
Set the the number of time the
SimpleTrigger should repeat,
after which it will be automatically deleted. |
void |
setRepeatInterval(long repeatInterval)
Set the the time interval (in milliseconds) at which the
SimpleTrigger should repeat. |
void |
setStartTime(Date startTime)
The time at which the trigger's scheduling should start.
|
void |
setTimesTriggered(int timesTriggered)
Set the number of times the
SimpleTrigger has already fired. |
void |
triggered(ICalendar calendar)
Called when the
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). |
void |
updateAfterMisfire(ICalendar cal)
Updates the
SimpleTrigger's state based on the
MISFIRE_INSTRUCTION_XXX that was selected when the
SimpleTrigger was created. |
void |
updateWithNewCalendar(ICalendar calendar,
long misfireThreshold)
This method should not be used by the Quartz client.
|
void |
validate()
Validates whether the properties of the
JobDetail are valid
for submission into a Scheduler. |
protected boolean |
validateMisfireInstruction(ITrigger.EMisfireInstruction misfireInstruction) |
compareTo, executionComplete, getCalendarName, getDescription, getFireInstanceId, getFullJobName, getFullName, getGroup, getJobDataMap, getJobGroup, getJobKey, getJobName, getKey, getMisfireInstruction, getName, getPriority, getTriggerBuilder, setCalendarName, setDescription, setFireInstanceId, setGroup, setJobDataMap, setJobGroup, setJobKey, setJobName, setKey, setMisfireInstruction, setName, setPriority, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetTriggerBuildercompareTo, getCalendarName, getDescription, getJobDataMap, getJobKey, getKey, getMisfireInstruction, getPrioritypublic SimpleTrigger(@Nonnull SimpleTrigger aOther)
public SimpleTrigger()
SimpleTrigger with no settings.@Nullable public final Date getStartTime()
ITriggerTrigger should occur.getStartTime in interface ITriggernull depending on the implementationpublic void setStartTime(@Nonnull Date startTime)
IMutableTriggersetStartTime in interface IMutableTriggerstartTime - start time@Nullable public final Date getEndTime()
ITriggerTrigger should quit repeating -
regardless of any remaining repeats (based on the trigger's particular
repeat settings).getEndTime in interface ITriggernull.ITrigger.getFinalFireTime()public final void setEndTime(@Nullable Date endTime)
IMutableTrigger
Set the time at which the Trigger should quit repeating -
regardless of any remaining repeats (based on the trigger's particular
repeat settings).
setEndTime in interface IMutableTriggerTriggerUtils.computeEndTimeToAllowParticularNumberOfFirings(IOperableTrigger,com.helger.quartz.ICalendar,int)public int getRepeatCount()
ISimpleTrigger
Get the the number of times the SimpleTrigger should repeat,
after which it will be automatically deleted.
getRepeatCount in interface ISimpleTriggerISimpleTrigger.REPEAT_INDEFINITELYpublic void setRepeatCount(int repeatCount)
Set the the number of time the SimpleTrigger should repeat,
after which it will be automatically deleted.
IllegalArgumentException - if repeatCount is < 0ISimpleTrigger.REPEAT_INDEFINITELYpublic long getRepeatInterval()
ISimpleTrigger
Get the the time interval (in milliseconds) at which the
SimpleTrigger should repeat.
getRepeatInterval in interface ISimpleTriggerpublic void setRepeatInterval(long repeatInterval)
Set the the time interval (in milliseconds) at which the
SimpleTrigger should repeat.
IllegalArgumentException - if repeatInterval is < 0public int getTimesTriggered()
Get the number of times the SimpleTrigger has already fired.
getTimesTriggered in interface ISimpleTriggerpublic void setTimesTriggered(int timesTriggered)
Set the number of times the SimpleTrigger has already fired.
protected boolean validateMisfireInstruction(ITrigger.EMisfireInstruction misfireInstruction)
validateMisfireInstruction in class AbstractTrigger<SimpleTrigger>public void updateAfterMisfire(ICalendar 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:
0, then the instruction will be
interpreted as MISFIRE_INSTRUCTION_FIRE_NOW.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.> 0, then the instruction will
be interpreted as
MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT.
updateAfterMisfire in interface IOperableTriggerpublic void triggered(ICalendar calendar)
IScheduler 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).triggered in interface IOperableTriggerAbstractTrigger.executionComplete(com.helger.quartz.IJobExecutionContext,
com.helger.quartz.JobExecutionException)public void updateWithNewCalendar(ICalendar calendar, long misfireThreshold)
IOperableTriggerTrigger'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).updateWithNewCalendar in interface IOperableTriggerIOperableTrigger.updateWithNewCalendar(com.helger.quartz.ICalendar,
long)public Date computeFirstFireTime(ICalendar 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.
computeFirstFireTime in interface IOperableTriggerTrigger will be fired by
the scheduler, which is also the same value
getNextFireTime() will return (until after the first
firing of the Trigger).public Date getNextFireTime()
Returns the next time at which the Trigger is scheduled to
fire. If the trigger will not fire again, null will be
returned. Note that the time returned can possibly be in the past, if the
time that was computed for the trigger to next fire has already arrived,
but the scheduler has not yet been able to fire the trigger (which would
likely be due to lack of resources e.g. threads).
The value returned is not guaranteed to be valid until after the
Trigger has been added to the scheduler.
getNextFireTime in interface ITriggerTriggerUtils.computeFireTimesBetween(com.helger.quartz.spi.IOperableTrigger,
ICalendar, Date, Date)public Date getPreviousFireTime()
SimpleTrigger fired. If
the trigger has not yet fired, null will be returned.getPreviousFireTime in interface ITriggerpublic void setNextFireTime(Date nextFireTime)
SimpleTrigger should fire.setNextFireTime in interface IOperableTriggerpublic void setPreviousFireTime(Date previousFireTime)
SimpleTrigger fired.setPreviousFireTime in interface IOperableTriggerpublic Date getFireTimeAfter(@Nullable Date aAfterTime)
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.
getFireTimeAfter in interface ITriggeraAfterTime - After time. May be nullpublic 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 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.
getFinalFireTime in interface ITriggerpublic boolean mayFireAgain()
Determines whether or not the SimpleTrigger will occur again.
mayFireAgain in interface ITriggerpublic void validate()
throws SchedulerException
Validates whether the properties of the JobDetail are valid
for submission into a Scheduler.
validate in interface IOperableTriggervalidate in class AbstractTrigger<SimpleTrigger>IllegalStateException - if a required property (such as Name, Group, Class) is not set.SchedulerExceptionpublic IScheduleBuilder<SimpleTrigger> getScheduleBuilder()
IScheduleBuilder that is configured to produce a schedule
identical to this trigger's schedule.getScheduleBuilder in interface ITriggergetScheduleBuilder in class AbstractTrigger<SimpleTrigger>AbstractTrigger.getTriggerBuilder()@Nonnull @ReturnsMutableCopy public SimpleTrigger getClone()
getClone in interface com.helger.commons.lang.ICloneable<SimpleTrigger>getClone in interface ITriggergetClone in interface IMutableTriggergetClone in interface IOperableTriggerpublic boolean equals(Object o)
AbstractTriggerequals in interface ITriggerequals in class AbstractTrigger<SimpleTrigger>public int hashCode()
hashCode in class AbstractTrigger<SimpleTrigger>Copyright © 2016–2021 Philip Helger. All rights reserved.