Method from org.quartz.Trigger Detail: |
public void addTriggerListener(String name) {
if (triggerListeners.contains(name)) {
throw new IllegalArgumentException(
"Trigger listener '" + name + "' is already registered for trigger: " + getFullName());
}
triggerListeners.add(name);
}
|
public void clearAllTriggerListeners() {
triggerListeners.clear();
}
|
public Object clone() {
Trigger copy;
try {
copy = (Trigger) super.clone();
copy.triggerListeners = (LinkedList)triggerListeners.clone();
// Shallow copy the jobDataMap. Note that this means that if a user
// modifies a value object in this map from the cloned Trigger
// they will also be modifying this Trigger.
if (jobDataMap != null) {
copy.jobDataMap = (JobDataMap)jobDataMap.clone();
}
} catch (CloneNotSupportedException ex) {
throw new IncompatibleClassChangeError("Not Cloneable.");
}
return copy;
}
|
public int compareTo(Object obj) {
Trigger other = (Trigger) obj;
Date myTime = getNextFireTime();
Date otherTime = other.getNextFireTime();
if (myTime == null && otherTime == null) {
return 0;
}
if (myTime == null) {
return 1;
}
if (otherTime == null) {
return -1;
}
if(myTime.before(otherTime)) {
return -1;
}
if(myTime.after(otherTime)) {
return 1;
}
return 0;
}
|
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) {
if (!(obj instanceof Trigger)) {
return false;
}
Trigger other = (Trigger) obj;
if (!other.getName().equals(getName())) {
return false;
}
if (!other.getGroup().equals(getGroup())) {
return false;
}
return true;
}
|
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() {
return calendarName;
}
|
public String getDescription() {
return description;
}
|
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() {
return fireInstanceId;
}
|
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() {
return jobGroup + "." + jobName;
}
Returns the 'full name' of the Job that the Trigger
points to, in the format "group.name".
|
public String getFullName() {
return group + "." + name;
}
|
public String getGroup() {
return group;
}
|
public JobDataMap getJobDataMap() {
if (jobDataMap == null) {
jobDataMap = new JobDataMap();
}
return jobDataMap;
}
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() {
return jobGroup;
}
|
public String getJobName() {
return jobName;
}
|
public Key getKey() {
if(key == null) {
key = new Key(getName(), getGroup());
}
return key;
}
|
public int getMisfireInstruction() {
return misfireInstruction;
}
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() {
return name;
}
|
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() {
return priority;
}
The priority of a Trigger acts as a tiebreaker such that if
two Trigger s 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()
|
public String[] getTriggerListenerNames() {
return (String[])triggerListeners.toArray(new String[triggerListeners.size()]);
}
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() {
return getFullName().hashCode();
}
|
public boolean isVolatile() {
return volatility;
}
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) {
return triggerListeners.remove(name);
}
|
public void setCalendarName(String calendarName) {
this.calendarName = calendarName;
}
|
public void setDescription(String description) {
this.description = 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.fireInstanceId = 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) {
if (group != null && group.trim().length() == 0) {
throw new IllegalArgumentException(
"Group name cannot be an empty string.");
}
if(group == null) {
group = Scheduler.DEFAULT_GROUP;
}
this.group = group;
}
|
public void setJobDataMap(JobDataMap jobDataMap) {
this.jobDataMap = jobDataMap;
}
|
public void setJobGroup(String jobGroup) {
if (jobGroup != null && jobGroup.trim().length() == 0) {
throw new IllegalArgumentException(
"Group name cannot be null or empty.");
}
if(jobGroup == null) {
jobGroup = Scheduler.DEFAULT_GROUP;
}
this.jobGroup = jobGroup;
}
|
public void setJobName(String jobName) {
if (jobName == null || jobName.trim().length() == 0) {
throw new IllegalArgumentException(
"Job name cannot be null or empty.");
}
this.jobName = jobName;
}
|
public void setMisfireInstruction(int misfireInstruction) {
if (!validateMisfireInstruction(misfireInstruction)) {
throw new IllegalArgumentException(
"The misfire instruction code is invalid for this type of trigger.");
}
this.misfireInstruction = 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) {
if (name == null || name.trim().length() == 0) {
throw new IllegalArgumentException(
"Trigger name cannot be null or empty.");
}
this.name = name;
}
|
public void setPriority(int priority) {
this.priority = priority;
}
The priority of a Trigger acts as a tiebreaker such that if
two Trigger s 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) {
this.volatility = 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 "Trigger '" + getFullName() + "': triggerClass: '"
+ getClass().getName() + " isVolatile: " + isVolatile()
+ " calendar: '" + getCalendarName() + "' misfireInstruction: "
+ getMisfireInstruction() + " nextFireTime: " + getNextFireTime();
}
|
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 {
if (name == null) {
throw new SchedulerException("Trigger's name cannot be null",
SchedulerException.ERR_CLIENT_ERROR);
}
if (group == null) {
throw new SchedulerException("Trigger's group cannot be null",
SchedulerException.ERR_CLIENT_ERROR);
}
if (jobName == null) {
throw new SchedulerException(
"Trigger's related Job's name cannot be null",
SchedulerException.ERR_CLIENT_ERROR);
}
if (jobGroup == null) {
throw new SchedulerException(
"Trigger's related Job's group cannot be null",
SchedulerException.ERR_CLIENT_ERROR);
}
}
|
abstract protected boolean validateMisfireInstruction(int misfireInstruction)
|