Package org.oddjob.scheduling
Class Retry
- All Implemented Interfaces:
Serializable,Runnable,ArooaContextAware,ArooaSessionAware,Forceable,PropertyChangeNotifier,Iconic,LogEnabled,Resettable,Stateful,Stoppable,Structural
- Author:
- Rob Gordon.
- See Also:
Description
This is a timer that runs it's job according to the schedule until the schedule expires or the job completes successfully.Example
File Polling. Check every 5 seconds for a file.
<oddjob id="this">
<job>
<scheduling:retry name="File Polling Example" xmlns:scheduling="http://rgordon.co.uk/oddjob/scheduling" xmlns:schedules="http://rgordon.co.uk/oddjob/schedules">
<schedule>
<schedules:interval interval="00:00:05"/>
</schedule>
<job>
<sequential id="look" name="Look for files">
<jobs>
<exists file="${this.dir}/work/*.foo" id="check" name="Check File Exists"/>
<echo name="Echo to Console">Found ${check.exists[0]}</echo>
</jobs>
</sequential>
</job>
</scheduling:retry>
</job>
</oddjob>
Using Retry with a Timer. A daily job retries twice.
<oddjob xmlns:schedules="http://rgordon.co.uk/oddjob/schedules" xmlns:scheduling="http://rgordon.co.uk/oddjob/scheduling" xmlns:state="http://rgordon.co.uk/oddjob/state">
<job>
<scheduling:timer id="timer">
<schedule>
<schedules:daily from="08:00"/>
</schedule>
<job>
<scheduling:retry id="retry">
<schedule>
<schedules:count count="2"/>
</schedule>
<job>
<state:flag id="flag-job" state="EXCEPTION"/>
</job>
</scheduling:retry>
</job>
</scheduling:timer>
</job>
</oddjob>
-
Field Summary
Fields inherited from class org.oddjob.scheduling.TimerBase
contextDataFields inherited from class org.oddjob.scheduling.ScheduleBase
begun, childHelper, childStateReflector, stateHandler, stop -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbegin()Sub classes must override this to submit the first execution.protected StateConditionprotected ResetActionImplementation provided by sub classes so limits are available inTimerBase.scheduleFrom(Date).protected StateOperatorSub classes provide the state operator that is used to calculate the subclasses completion state.protected booleanvoidMethods inherited from class org.oddjob.scheduling.TimerBase
CancelAndStopChild, changeStateLocked, getClock, getCurrent, getHaltOn, getLastDue, getNextDue, getReset, getSchedule, getTimeZone, handleChildState, internalSetNextDue, onReset, onStop, postStop, reschedule, reset, scheduleFrom, setClock, setHaltOn, setJob, setNextDue, setReschedule, setReset, setSchedule, setScheduleExecutorService, setTimeZoneMethods inherited from class org.oddjob.scheduling.ScheduleBase
addStructuralListener, fireDestroyedState, force, getStateChanger, hardReset, iconHelper, onDestroy, removeStructuralListener, run, softReset, stateHandler, stopMethods inherited from class org.oddjob.framework.extend.BasePrimary
configure, getName, logger, logger, loggerName, save, setName, toStringMethods inherited from class org.oddjob.framework.extend.BaseComponent
addIconListener, addPropertyChangeListener, addStateListener, configure, destroy, firePropertyChange, getArooaSession, iconForId, initialise, lastStateEvent, onConfigured, onInitialised, removeIconListener, removePropertyChangeListener, removeStateListener, save, setArooaContext, setArooaSessionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.oddjob.Stateful
addStateListener, lastStateEvent, removeStateListener
-
Constructor Details
-
Retry
public Retry()
-
-
Method Details
-
getStateOp
Description copied from class:ScheduleBaseSub classes provide the state operator that is used to calculate the subclasses completion state.- Specified by:
getStateOpin classScheduleBase- Returns:
- The operator. Must not be null.
-
begin
Description copied from class:ScheduleBaseSub classes must override this to submit the first execution.- Overrides:
beginin classTimerBase- Throws:
ComponentPersistException- If the scheduled time can't be saved.
-
setLimits
-
getLimits
Description copied from class:TimerBaseImplementation provided by sub classes so limits are available inTimerBase.scheduleFrom(Date). -
isSkipMissedRuns
protected boolean isSkipMissedRuns()- Specified by:
isSkipMissedRunsin classTimerBase
-
getDefaultHaltOn
- Specified by:
getDefaultHaltOnin classTimerBase
-
getDefaultReset
- Specified by:
getDefaultResetin classTimerBase
-