Java Code Examples for org.quartz.Trigger#MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY
The following examples show how to use
org.quartz.Trigger#MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CronTriggerImpl.java From lams with GNU General Public License v2.0 | 6 votes |
/** * <p> * Updates the <code>CronTrigger</code>'s state based on the * MISFIRE_INSTRUCTION_XXX that was selected when the <code>CronTrigger</code> * was created. * </p> * * <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> * </p> */ @Override public void updateAfterMisfire(org.quartz.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()); } }
Example 2
Source File: DefaultClusteredJobStore.java From lams with GNU General Public License v2.0 | 5 votes |
boolean applyMisfire(TriggerWrapper tw) throws JobPersistenceException { long misfireTime = System.currentTimeMillis(); if (getMisfireThreshold() > 0) { misfireTime -= getMisfireThreshold(); } Date tnft = tw.getNextFireTime(); if (tnft == null || tnft.getTime() > misfireTime || tw.getMisfireInstruction() == Trigger.MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY) { return false; } Calendar cal = null; if (tw.getCalendarName() != null) { cal = retrieveCalendar(tw.getCalendarName()); } signaler.notifyTriggerListenersMisfired(tw.getTriggerClone()); tw.updateAfterMisfire(cal, triggerFacade); if (tw.getNextFireTime() == null) { tw.setState(TriggerState.COMPLETE, terracottaClientId, triggerFacade); signaler.notifySchedulerListenersFinalized(tw.getTriggerClone()); timeTriggers.remove(tw); } else if (tnft.equals(tw.getNextFireTime())) { return false; } return true; }
Example 3
Source File: RAMJobStore.java From lams with GNU General Public License v2.0 | 5 votes |
protected boolean applyMisfire(TriggerWrapper tw) { long misfireTime = System.currentTimeMillis(); if (getMisfireThreshold() > 0) { misfireTime -= getMisfireThreshold(); } Date tnft = tw.trigger.getNextFireTime(); if (tnft == null || tnft.getTime() > misfireTime || tw.trigger.getMisfireInstruction() == Trigger.MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY) { return false; } Calendar cal = null; if (tw.trigger.getCalendarName() != null) { cal = retrieveCalendar(tw.trigger.getCalendarName()); } signaler.notifyTriggerListenersMisfired((OperableTrigger)tw.trigger.clone()); tw.trigger.updateAfterMisfire(cal); if (tw.trigger.getNextFireTime() == null) { tw.state = TriggerWrapper.STATE_COMPLETE; signaler.notifySchedulerListenersFinalized(tw.trigger); synchronized (lock) { timeTriggers.remove(tw); } } else if (tnft.equals(tw.trigger.getNextFireTime())) { return false; } return true; }
Example 4
Source File: DailyTimeIntervalTriggerImpl.java From lams with GNU General Public License v2.0 | 5 votes |
/** * <p> * Updates the <code>DailyTimeIntervalTrigger</code>'s state based on the * MISFIRE_INSTRUCTION_XXX that was selected when the <code>DailyTimeIntervalTrigger</code> * was created. * </p> * * <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> * </p> */ @Override public void updateAfterMisfire(org.quartz.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) { // fire once now... setNextFireTime(new Date()); // the new fire time afterward will magically preserve the original // time of day for firing for day/week/month interval triggers, // because of the way getFireTimeAfter() works - in its always restarting // computation from the start time. } }
Example 5
Source File: CalendarIntervalTriggerImpl.java From lams with GNU General Public License v2.0 | 5 votes |
/** * <p> * Updates the <code>DateIntervalTrigger</code>'s state based on the * MISFIRE_INSTRUCTION_XXX that was selected when the <code>DateIntervalTrigger</code> * was created. * </p> * * <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> * </p> */ @Override public void updateAfterMisfire(org.quartz.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) { // fire once now... setNextFireTime(new Date()); // the new fire time afterward will magically preserve the original // time of day for firing for day/week/month interval triggers, // because of the way getFireTimeAfter() works - in its always restarting // computation from the start time. } }
Example 6
Source File: JobStoreImpl.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
/** * Determine if trigger has misfired. */ private boolean applyMisfire(final ODatabaseDocumentTx db, final TriggerEntity triggerEntity) { log.trace("Checking for misfire: {}", triggerEntity); OperableTrigger trigger = triggerEntity.getValue(); long misfireTime = getMisfireTime(); Date nextFireTime = trigger.getNextFireTime(); if (nextFireTime == null || nextFireTime.getTime() > misfireTime || trigger.getMisfireInstruction() == Trigger.MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY) { return false; } // resolve trigger calender if there is one Calendar calendar = null; if (trigger.getCalendarName() != null) { calendar = findCalendar(db, trigger.getCalendarName()); } signaler.notifyTriggerListenersMisfired(trigger); trigger.updateAfterMisfire(calendar); if (trigger.getNextFireTime() == null) { triggerEntity.setState(COMPLETE); triggerEntityAdapter.editEntity(db, triggerEntity); signaler.notifySchedulerListenersFinalized(trigger); } else if (nextFireTime.equals(trigger.getNextFireTime())) { return false; } return true; }
Example 7
Source File: JobStoreImpl.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
private boolean canBeAcquired(final TriggerEntity entity, final ODatabaseDocumentTx db, final long timeWindowStart, final long timeWindowEnd) { OperableTrigger trigger = entity.getValue(); // skip triggers which have no next fire time if (trigger.getNextFireTime() == null) { return false; } // skip triggers which match misfire fudge logic (if the trigger will no longer fire) // NOTE: applyMisfire(...) may modify trigger.getNextFireTime() if (applyMisfire(db, entity) && trigger.getNextFireTime() == null) { return false; } // skip triggers which fire outside of requested window if (trigger.getNextFireTime().getTime() > timeWindowEnd) { return false; } // skip triggers which fire outside of requested window if (trigger.getMisfireInstruction() != Trigger.MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY && trigger.getNextFireTime().getTime() < timeWindowStart) { return false; } // check after misfire logic to avoid repeated log-spam if (isClustered() && isLimitedToMissingNode(entity)) { return false; } return true; }
Example 8
Source File: RedisJobStore.java From redis-quartz with MIT License | 5 votes |
protected boolean applyMisfire(OperableTrigger trigger, Jedis jedis) throws JobPersistenceException { long misfireTime = System.currentTimeMillis(); if (getMisfireThreshold() > 0) misfireTime -= getMisfireThreshold(); Date triggerNextFireTime = trigger.getNextFireTime(); if (triggerNextFireTime == null || triggerNextFireTime.getTime() > misfireTime || trigger.getMisfireInstruction() == Trigger.MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY) { return false; } Calendar cal = null; if (trigger.getCalendarName() != null) cal = retrieveCalendar(trigger.getCalendarName(), jedis); signaler.notifyTriggerListenersMisfired((OperableTrigger)trigger.clone()); trigger.updateAfterMisfire(cal); if (triggerNextFireTime.equals(trigger.getNextFireTime())) return false; storeTrigger(trigger, true, jedis); if (trigger.getNextFireTime() == null) { // Trigger completed setTriggerState(RedisTriggerState.COMPLETED, (double)System.currentTimeMillis(), createTriggerHashKey(trigger.getKey().getGroup(), trigger.getKey().getName())); signaler.notifySchedulerListenersFinalized(trigger); } return true; }