/** * Retrieve the given <code>{@link org.quartz.triggers.Trigger}</code>. * * @param calName The name of the <code>Calendar</code> to be retrieved. * @return The desired <code>Calendar</code>, or null if there is no match. */ @Override public Calendar retrieveCalendar(String calName) { synchronized (lock) { Calendar cal = calendarsByName.get(calName); if (cal != null) { return (Calendar) cal.clone(); } return null; } }
/** * <p> * Called when the <code>{@link 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). * </p> * * @see #executionComplete(JobExecutionContext, JobExecutionException) */ @Override public void triggered(org.quartz.core.Calendar calendar) { previousFireTime = nextFireTime; nextFireTime = getFireTimeAfter(nextFireTime); while (nextFireTime != null && calendar != null && !calendar.isTimeIncluded(nextFireTime.getTime())) { nextFireTime = getFireTimeAfter(nextFireTime); } }
/** * <p> * Called when the <code>{@link 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). * </p> * * @see #executionComplete(JobExecutionContext, JobExecutionException) */ @Override public void triggered(Calendar calendar) { timesTriggered++; previousFireTime = nextFireTime; nextFireTime = getFireTimeAfter(nextFireTime); while (nextFireTime != null && calendar != null && !calendar.isTimeIncluded(nextFireTime.getTime())) { nextFireTime = getFireTimeAfter(nextFireTime); if (nextFireTime == null) { break; } // avoid infinite loop java.util.Calendar c = java.util.Calendar.getInstance(); c.setTime(nextFireTime); if (c.get(java.util.Calendar.YEAR) > YEAR_TO_GIVEUP_SCHEDULING_AT) { nextFireTime = null; } } }
/** * <p> * Retrieve the given <code>{@link org.quartz.triggers.Trigger}</code>. * </p> * * @param calName The name of the <code>Calendar</code> to be retrieved. * @return The desired <code>Calendar</code>, or null if there is no match. */ @Override public Calendar retrieveCalendar(String calName) { synchronized (lock) { Calendar cal = calendarsByName.get(calName); if (cal != null) { return (Calendar) cal.clone(); } return null; } }
/** * <p> * Called when the <code>{@link 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). * </p> * * @see #executionComplete(JobExecutionContext, JobExecutionException) */ @Override public void triggered(Calendar calendar) { timesTriggered++; previousFireTime = nextFireTime; nextFireTime = getFireTimeAfter(nextFireTime); while (nextFireTime != null && calendar != null && !calendar.isTimeIncluded(nextFireTime.getTime())) { nextFireTime = getFireTimeAfter(nextFireTime); if (nextFireTime == null) { break; } // avoid infinite loop java.util.Calendar c = java.util.Calendar.getInstance(); c.setTime(nextFireTime); if (c.get(java.util.Calendar.YEAR) > YEAR_TO_GIVEUP_SCHEDULING_AT) { nextFireTime = null; } } }
/** * <p> * Retrieve the given <code>{@link org.quartz.triggers.Trigger}</code>. * </p> * * @param calName The name of the <code>Calendar</code> to be retrieved. * @return The desired <code>Calendar</code>, or null if there is no match. */ @Override public Calendar retrieveCalendar(String calName) { synchronized (lock) { Calendar cal = calendarsByName.get(calName); if (cal != null) { return (Calendar) cal.clone(); } return null; } }
/** * Called when the <code>{@link 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). * * @see #executionComplete(JobExecutionContext, JobExecutionException) */ @Override public void triggered(Calendar calendar) { timesTriggered++; previousFireTime = nextFireTime; nextFireTime = getFireTimeAfter(nextFireTime); while (nextFireTime != null && calendar != null && !calendar.isTimeIncluded(nextFireTime.getTime())) { nextFireTime = getFireTimeAfter(nextFireTime); if (nextFireTime == null) { break; } // avoid infinite loop java.util.Calendar c = java.util.Calendar.getInstance(); c.setTime(nextFireTime); if (c.get(java.util.Calendar.YEAR) > YEAR_TO_GIVEUP_SCHEDULING_AT) { nextFireTime = null; } } }
/** * <p> * Called when the <code>{@link 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). * </p> * * @see #executionComplete(JobExecutionContext, JobExecutionException) */ @Override public void triggered(org.quartz.core.Calendar calendar) { previousFireTime = nextFireTime; nextFireTime = getFireTimeAfter(nextFireTime); while (nextFireTime != null && calendar != null && !calendar.isTimeIncluded(nextFireTime.getTime())) { nextFireTime = getFireTimeAfter(nextFireTime); } }
/** * <p> * 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> * <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 * <code>getNextFireTime()</code> will return (until after the first firing of the <code>Trigger</code>). * </p> */ @Override public Date computeFirstFireTime(Calendar calendar) { nextFireTime = getStartTime(); while (nextFireTime != null && calendar != null && !calendar.isTimeIncluded(nextFireTime.getTime())) { nextFireTime = getFireTimeAfter(nextFireTime); if (nextFireTime == null) { break; } // avoid infinite loop java.util.Calendar c = java.util.Calendar.getInstance(); c.setTime(nextFireTime); if (c.get(java.util.Calendar.YEAR) > YEAR_TO_GIVEUP_SCHEDULING_AT) { return null; } } return nextFireTime; }
/** * Called when the <code>{@link 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). * * @see #executionComplete(JobExecutionContext, JobExecutionException) */ @Override public void triggered(org.quartz.core.Calendar calendar) { previousFireTime = nextFireTime; nextFireTime = getFireTimeAfter(nextFireTime); while (nextFireTime != null && calendar != null && !calendar.isTimeIncluded(nextFireTime.getTime())) { nextFireTime = getFireTimeAfter(nextFireTime); } }
/** * <p> * 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> * <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 * <code>getNextFireTime()</code> will return (until after the first firing of the <code>Trigger</code>). </p> */ @Override public Date computeFirstFireTime(org.quartz.core.Calendar calendar) { nextFireTime = getFireTimeAfter(new Date(getStartTime().getTime() - 1000l)); while (nextFireTime != null && calendar != null && !calendar.isTimeIncluded(nextFireTime.getTime())) { nextFireTime = getFireTimeAfter(nextFireTime); } return nextFireTime; }
&& !calendar.isTimeIncluded(nextFireTime.getTime())) { nextFireTime = getFireTimeAfter(nextFireTime);
/** * 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. * * @return the first time at which the <code>Trigger</code> will be fired by the scheduler, which * is also the same value <code>getNextFireTime()</code> will return (until after the first * firing of the <code>Trigger</code>). */ @Override public Date computeFirstFireTime(org.quartz.core.Calendar calendar) { nextFireTime = getFireTimeAfter(new Date(getStartTime().getTime() - 1000l)); while (nextFireTime != null && calendar != null && !calendar.isTimeIncluded(nextFireTime.getTime())) { nextFireTime = getFireTimeAfter(nextFireTime); } return nextFireTime; }
/** * <p> * 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> * <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 * <code>getNextFireTime()</code> will return (until after the first firing of the <code>Trigger</code>). </p> */ @Override public Date computeFirstFireTime(Calendar calendar) { nextFireTime = getStartTime(); while (nextFireTime != null && calendar != null && !calendar.isTimeIncluded(nextFireTime.getTime())) { nextFireTime = getFireTimeAfter(nextFireTime); if (nextFireTime == null) { break; } // avoid infinite loop java.util.Calendar c = java.util.Calendar.getInstance(); c.setTime(nextFireTime); if (c.get(java.util.Calendar.YEAR) > YEAR_TO_GIVEUP_SCHEDULING_AT) { return null; } } return nextFireTime; }
/** * <p> * 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> * <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 * <code>getNextFireTime()</code> will return (until after the first firing of the <code>Trigger</code>). * </p> */ @Override public Date computeFirstFireTime(org.quartz.core.Calendar calendar) { nextFireTime = getFireTimeAfter(new Date(getStartTime().getTime() - 1000l)); while (nextFireTime != null && calendar != null && !calendar.isTimeIncluded(nextFireTime.getTime())) { nextFireTime = getFireTimeAfter(nextFireTime); } return nextFireTime; }
/** * Updates the <code>CronTrigger</code>'s state based on the MISFIRE_INSTRUCTION_XXX that was * selected when the <code>CronTrigger</code> was created. * * <p>If the misfire instruction is set to MISFIRE_INSTRUCTION_SMART_POLICY, then the following * scheme will be used: <br> * * <ul> * <li>The instruction will be interpreted as <code>MISFIRE_INSTRUCTION_FIRE_ONCE_NOW</code> * </ul> */ @Override public void updateAfterMisfire(org.quartz.core.Calendar cal) { int instr = getMisfireInstruction(); if (instr == Trigger.MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY) { return; } if (instr == MISFIRE_INSTRUCTION_SMART_POLICY) { instr = MISFIRE_INSTRUCTION_FIRE_ONCE_NOW; } if (instr == MISFIRE_INSTRUCTION_DO_NOTHING) { Date newFireTime = getFireTimeAfter(new Date()); while (newFireTime != null && cal != null && !cal.isTimeIncluded(newFireTime.getTime())) { newFireTime = getFireTimeAfter(newFireTime); } setNextFireTime(newFireTime); } else if (instr == MISFIRE_INSTRUCTION_FIRE_ONCE_NOW) { setNextFireTime(new Date()); } }
while (newFireTime != null && cal != null && !cal.isTimeIncluded(newFireTime.getTime())) { newFireTime = getFireTimeAfter(newFireTime);
while (newFireTime != null && cal != null && !cal.isTimeIncluded(newFireTime.getTime())) { newFireTime = getFireTimeAfter(newFireTime);
} else if (instr == MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT) { Date newFireTime = getFireTimeAfter(new Date()); while (newFireTime != null && cal != null && !cal.isTimeIncluded(newFireTime.getTime())) { newFireTime = getFireTimeAfter(newFireTime); } else if (instr == MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT) { Date newFireTime = getFireTimeAfter(new Date()); while (newFireTime != null && cal != null && !cal.isTimeIncluded(newFireTime.getTime())) { newFireTime = getFireTimeAfter(newFireTime);
} else if (instr == MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT) { Date newFireTime = getFireTimeAfter(new Date()); while (newFireTime != null && cal != null && !cal.isTimeIncluded(newFireTime.getTime())) { newFireTime = getFireTimeAfter(newFireTime); } else if (instr == MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT) { Date newFireTime = getFireTimeAfter(new Date()); while (newFireTime != null && cal != null && !cal.isTimeIncluded(newFireTime.getTime())) { newFireTime = getFireTimeAfter(newFireTime);