/** * Called when the <CODE>Scheduler</CODE> has decided to 'fire' the trigger * (execute the associated <CODE>Job</CODE>), in order to give the * <CODE>Trigger</CODE> a chance to update itself for its next triggering * (if any). */ public void triggered(Calendar calendar) { this.calendar = calendar; this.previousFireTime = this.nextFireTime; this.nextFireTime = getFireTimeAfter(this.nextFireTime); }
/** * Updates the <CODE>NthIncludedDayTrigger</CODE>'s state based on the * MISFIRE_INSTRUCTION_XXX that was selected when the * <CODE>NthIncludedDayTrigger</CODE> was created * <P> * If the misfire instruction is set to MISFIRE_INSTRUCTION_SMART_POLICY, * then the instruction will be interpreted as * {@link #MISFIRE_INSTRUCTION_FIRE_ONCE_NOW}. * * @param calendar a new or updated calendar to use for the trigger */ public void updateAfterMisfire(Calendar calendar) { int instruction = getMisfireInstruction(); this.calendar = calendar; if (instruction == MISFIRE_INSTRUCTION_SMART_POLICY) { instruction = MISFIRE_INSTRUCTION_FIRE_ONCE_NOW; } if (instruction == MISFIRE_INSTRUCTION_DO_NOTHING) { this.nextFireTime = getFireTimeAfter(new Date()); } else if (instruction == MISFIRE_INSTRUCTION_FIRE_ONCE_NOW) { this.nextFireTime = new Date(); } }
/** * Used by the <CODE>Scheduler</CODE> to determine whether or not it is * possible for this <CODE>Trigger</CODE> to fire again. * <P> * If the returned value is <CODE>false</CODE> then the * <CODE>Scheduler</CODE> may remove the <CODE>Trigger</CODE> from the * <CODE>JobStore</CODE> * * @return a boolean indicator of whether the trigger could potentially fire * again */ public boolean mayFireAgain() { return (getNextFireTime() != null); }
return getWeeklyFireTimeAfter(afterTime); } else if (this.intervalType == INTERVAL_TYPE_MONTHLY) { return getMonthlyFireTimeAfter(afterTime); } else if (this.intervalType == INTERVAL_TYPE_YEARLY) { return getYearlyFireTimeAfter(afterTime); } else { return null;
public Object clone() { NthIncludedDayTrigger copy = (NthIncludedDayTrigger) super.clone(); if(getTimeZone() != null) copy.timeZone = (TimeZone) getTimeZone().clone(); return copy; }
/** * Called after the <CODE>Scheduler</CODE> has executed the * <code>JobDetail</CODE> associated with the <CODE>Trigger</CODE> in order * to get the final instruction code from the trigger. * * @param jobCtx the <CODE>JobExecutionContext</CODE> that was used by the * <CODE>Job</CODE>'s <CODE>execute()</CODE> method. * @param result the <CODE>JobExecutionException</CODE> thrown by the * <CODE>Job</CODE>, if any (may be <CODE>null</CODE>) * @return one of the Trigger.INSTRUCTION_XXX constants. */ public int executionComplete(JobExecutionContext jobCtx, JobExecutionException result) { if (result != null && result.refireImmediately()) { return INSTRUCTION_RE_EXECUTE_JOB; } if (result != null && result.unscheduleFiringTrigger()) { return INSTRUCTION_SET_TRIGGER_COMPLETE; } if (result != null && result.unscheduleAllTriggers()) { return INSTRUCTION_SET_ALL_JOB_TRIGGERS_COMPLETE; } if (!mayFireAgain()) { return INSTRUCTION_DELETE_TRIGGER; } return INSTRUCTION_NOOP; }
return getWeeklyFireTimeAfter(afterTime); } else if (this.intervalType == INTERVAL_TYPE_MONTHLY) { return getMonthlyFireTimeAfter(afterTime); } else if (this.intervalType == INTERVAL_TYPE_YEARLY) { return getYearlyFireTimeAfter(afterTime); } else { return null;
boolean gotOne = false; afterCal = java.util.Calendar.getInstance(getTimeZone()); afterCal.setTime(afterDate); currCal = java.util.Calendar.getInstance(getTimeZone()); currCal.set(afterCal.get(java.util.Calendar.YEAR), afterCal.get(java.util.Calendar.MONTH), 1);
/** * Called after the <CODE>Scheduler</CODE> has executed the * <code>JobDetail</CODE> associated with the <CODE>Trigger</CODE> in order * to get the final instruction code from the trigger. * * @param jobCtx the <CODE>JobExecutionContext</CODE> that was used by the * <CODE>Job</CODE>'s <CODE>execute()</CODE> method. * @param result the <CODE>JobExecutionException</CODE> thrown by the * <CODE>Job</CODE>, if any (may be <CODE>null</CODE>) * @return one of the Trigger.INSTRUCTION_XXX constants. */ public int executionComplete(JobExecutionContext jobCtx, JobExecutionException result) { if (result != null && result.refireImmediately()) { return INSTRUCTION_RE_EXECUTE_JOB; } if (result != null && result.unscheduleFiringTrigger()) { return INSTRUCTION_SET_TRIGGER_COMPLETE; } if (result != null && result.unscheduleAllTriggers()) { return INSTRUCTION_SET_ALL_JOB_TRIGGERS_COMPLETE; } if (!mayFireAgain()) { return INSTRUCTION_DELETE_TRIGGER; } return INSTRUCTION_NOOP; }
return getWeeklyFireTimeAfter(afterTime); } else if (this.intervalType == INTERVAL_TYPE_MONTHLY) { return getMonthlyFireTimeAfter(afterTime); } else if (this.intervalType == INTERVAL_TYPE_YEARLY) { return getYearlyFireTimeAfter(afterTime); } else { return null;
/** * Called when the <CODE>Scheduler</CODE> has decided to 'fire' the trigger * (execute the associated <CODE>Job</CODE>), in order to give the * <CODE>Trigger</CODE> a chance to update itself for its next triggering * (if any). */ public void triggered(Calendar calendar) { this.calendar = calendar; this.previousFireTime = this.nextFireTime; this.nextFireTime = getFireTimeAfter(this.nextFireTime); }
/** * Updates the <CODE>NthIncludedDayTrigger</CODE>'s state based on the * MISFIRE_INSTRUCTION_XXX that was selected when the * <CODE>NthIncludedDayTrigger</CODE> was created * <P> * If the misfire instruction is set to MISFIRE_INSTRUCTION_SMART_POLICY, * then the instruction will be interpreted as * {@link #MISFIRE_INSTRUCTION_FIRE_ONCE_NOW}. * * @param calendar a new or updated calendar to use for the trigger */ public void updateAfterMisfire(Calendar calendar) { int instruction = getMisfireInstruction(); this.calendar = calendar; if (instruction == MISFIRE_INSTRUCTION_SMART_POLICY) { instruction = MISFIRE_INSTRUCTION_FIRE_ONCE_NOW; } if (instruction == MISFIRE_INSTRUCTION_DO_NOTHING) { this.nextFireTime = getFireTimeAfter(new Date()); } else if (instruction == MISFIRE_INSTRUCTION_FIRE_ONCE_NOW) { this.nextFireTime = new Date(); } }
boolean gotOne = false; afterCal = java.util.Calendar.getInstance(getTimeZone()); afterCal.setTime(afterDate); currCal = java.util.Calendar.getInstance(getTimeZone()); currCal.set(afterCal.get(java.util.Calendar.YEAR), java.util.Calendar.JANUARY, 1);
/** * Used by the <CODE>Scheduler</CODE> to determine whether or not it is * possible for this <CODE>Trigger</CODE> to fire again. * <P> * If the returned value is <CODE>false</CODE> then the * <CODE>Scheduler</CODE> may remove the <CODE>Trigger</CODE> from the * <CODE>JobStore</CODE> * * @return a boolean indicator of whether the trigger could potentially fire * again */ public boolean mayFireAgain() { return (getNextFireTime() != null); }
/** * Called when the <CODE>Scheduler</CODE> has decided to 'fire' the trigger * (execute the associated <CODE>Job</CODE>), in order to give the * <CODE>Trigger</CODE> a chance to update itself for its next triggering * (if any). */ public void triggered(Calendar calendar) { this.calendar = calendar; this.previousFireTime = this.nextFireTime; this.nextFireTime = getFireTimeAfter(this.nextFireTime); }
/** * Updates the <CODE>NthIncludedDayTrigger</CODE>'s state based on the * MISFIRE_INSTRUCTION_XXX that was selected when the * <CODE>NthIncludedDayTrigger</CODE> was created * <P> * If the misfire instruction is set to MISFIRE_INSTRUCTION_SMART_POLICY, * then the instruction will be interpreted as * {@link #MISFIRE_INSTRUCTION_FIRE_ONCE_NOW}. * * @param calendar a new or updated calendar to use for the trigger */ public void updateAfterMisfire(Calendar calendar) { int instruction = getMisfireInstruction(); this.calendar = calendar; if (instruction == MISFIRE_INSTRUCTION_SMART_POLICY) { instruction = MISFIRE_INSTRUCTION_FIRE_ONCE_NOW; } if (instruction == MISFIRE_INSTRUCTION_DO_NOTHING) { this.nextFireTime = getFireTimeAfter(new Date()); } else if (instruction == MISFIRE_INSTRUCTION_FIRE_ONCE_NOW) { this.nextFireTime = new Date(); } }
boolean gotOne = false; afterCal = java.util.Calendar.getInstance(getTimeZone()); afterCal.setTime(afterDate); currCal = java.util.Calendar.getInstance(getTimeZone()); currCal.set(afterCal.get(java.util.Calendar.YEAR), java.util.Calendar.JANUARY, 1);
/** * Used by the <CODE>Scheduler</CODE> to determine whether or not it is * possible for this <CODE>Trigger</CODE> to fire again. * <P> * If the returned value is <CODE>false</CODE> then the * <CODE>Scheduler</CODE> may remove the <CODE>Trigger</CODE> from the * <CODE>JobStore</CODE> * * @return a boolean indicator of whether the trigger could potentially fire * again */ public boolean mayFireAgain() { return (getNextFireTime() != null); }
/** * Called by the scheduler at the time a <CODE>Trigger</code> is first * added to the scheduler, in order to have the <CODE>Trigger</CODE> * compute its first fire time, based on any associated calendar. * <P> * After this method has been called, <CODE>getNextFireTime()</CODE> * should return a valid answer. * </p> * * @return the first time at which the <CODE>Trigger</CODE> will be fired * by the scheduler, which is also the same value * {@link #getNextFireTime()} will return (until after the first * firing of the <CODE>Trigger</CODE>). */ public Date computeFirstFireTime(Calendar calendar) { this.calendar = calendar; this.nextFireTime = getFireTimeAfter(new Date(this.startTime.getTime() - 1000l)); return this.nextFireTime; }
boolean gotOne = false; afterCal = java.util.Calendar.getInstance(getTimeZone()); afterCal.setTime(afterDate); currCal = java.util.Calendar.getInstance(getTimeZone()); currCal.set(afterCal.get(java.util.Calendar.YEAR), afterCal.get(java.util.Calendar.MONTH), 1);