public abstract class TimerBase extends ScheduleBase
Modifier and Type | Field and Description |
---|---|
protected Map<Object,Object> |
contextData
Provided to the schedule.
|
begun, childHelper, childStateReflector, stateHandler, stop
Constructor and Description |
---|
TimerBase() |
Modifier and Type | Method and Description |
---|---|
protected void |
begin()
Sub classes must override this to submit the first execution.
|
protected void |
CancelAndStopChild()
Cancel and child jobs that are submitted and stop any that are
running.
|
protected boolean |
changeStateLocked(TimerState required) |
Clock |
getClock()
Get the current clock.
|
ScheduleResult |
getCurrent()
Get the current/next interval.
|
protected abstract StateCondition |
getDefaultHaltOn() |
protected abstract ResetAction |
getDefaultReset() |
StateCondition |
getHaltOn() |
Date |
getLastDue()
Get the last due date.
|
protected abstract Interval |
getLimits()
Implementation provided by sub classes so limits are available in
scheduleFrom(Date) . |
Date |
getNextDue()
Get the next due date.
|
ResetAction |
getReset() |
Schedule |
getSchedule() |
String |
getTimeZone()
Get the time zone id to use in this schedule.
|
protected void |
handleChildState(StateEvent event,
StateListener listener) |
protected boolean |
internalSetNextDue(Date nextDue)
Set the next due date.
|
protected abstract boolean |
isSkipMissedRuns() |
protected void |
onReset()
Override by subclasses to reset state.
|
protected void |
onStop()
Subclasses can override to perform stopping operations.
|
protected void |
postStop()
Subclasses can override to perform actions once children have stopped.
|
protected boolean |
reschedule()
Reschedule a job.
|
protected void |
reset(Resetable job)
Implementation provided by sub classes to decide what kind of reset to send
to the child.
|
protected boolean |
scheduleFrom(Date date)
Schedule a job from a given date.
|
void |
setClock(Clock clock)
Set the clock.
|
void |
setHaltOn(StateCondition haltOn) |
void |
setJob(Runnable job) |
void |
setNextDue(Date nextDue)
Manually set the Next Due Date.
|
void |
setReschedule(Date reSchedule) |
void |
setReset(ResetAction reset) |
void |
setSchedule(Schedule schedule)
Set the schedule.
|
void |
setScheduleExecutorService(ScheduledExecutorService scheduler) |
void |
setTimeZone(String timeZoneId)
Set the time zone.
|
addStructuralListener, fireDestroyedState, force, getStateChanger, getStateOp, hardReset, iconHelper, onDestroy, removeStructuralListener, run, softReset, stateHandler, stop
configure, getName, logger, logger, loggerName, save, setName, toString
addIconListener, addPropertyChangeListener, addStateListener, configure, destroy, firePropertyChange, getArooaSession, iconForId, initialise, lastStateEvent, onConfigured, onInitialised, removeIconListener, removePropertyChangeListener, removeStateListener, save, setArooaContext, setArooaSession
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addStateListener, lastStateEvent, removeStateListener
@Inject public void setScheduleExecutorService(ScheduledExecutorService scheduler)
protected void begin() throws ComponentPersistException
ScheduleBase
begin
in class ScheduleBase
ComponentPersistException
protected void onStop()
ScheduleBase
onStop
in class ScheduleBase
protected void postStop()
ScheduleBase
postStop
in class ScheduleBase
protected void onReset()
ScheduleBase
onReset
in class ScheduleBase
public String getTimeZone()
public void setTimeZone(String timeZoneId)
timeZoneId
- the timeZoneId.public void setSchedule(Schedule schedule)
schedule
- The schedule.public Schedule getSchedule()
public void setReschedule(Date reSchedule) throws ComponentPersistException, OddjobLockedException
Property: reschedule
Description: Reschedule from the given date/time.
Required: Only available once the timer has started.
ComponentPersistException
OddjobLockedException
protected void CancelAndStopChild() throws FailedToStopException
FailedToStopException
protected boolean scheduleFrom(Date date) throws ComponentPersistException
date
- The date to schedule the job from.ComponentPersistException
public Clock getClock()
public void setClock(Clock clock)
clock
- The clock.public void setNextDue(Date nextDue) throws OddjobLockedException
nextDue
- The Next Due Date. May be null.OddjobLockedException
public Date getNextDue()
protected boolean internalSetNextDue(Date nextDue) throws ComponentPersistException
nextDue
- The date schedule is next due. If null the job won't
be scheduled and the child state reflector will be called to reflect
the state of the child job.ComponentPersistException
public ScheduleResult getCurrent()
public Date getLastDue()
public void setJob(Runnable job)
Property: job
Description: The job to run when it's due.
Required: Yes.
protected abstract Interval getLimits()
scheduleFrom(Date)
.protected boolean reschedule() throws ComponentPersistException
ComponentPersistException
protected void reset(Resetable job)
job
- The child job that will be reset.protected void handleChildState(StateEvent event, StateListener listener) throws ComponentPersistException
ComponentPersistException
protected boolean changeStateLocked(TimerState required)
public StateCondition getHaltOn()
public void setHaltOn(StateCondition haltOn)
protected abstract StateCondition getDefaultHaltOn()
protected abstract boolean isSkipMissedRuns()
public ResetAction getReset()
public void setReset(ResetAction reset)
protected abstract ResetAction getDefaultReset()