public final class AfterSchedule extends AbstractSchedule implements java.io.Serializable
This can be useful when wanting a schedule to begin at the end of an interval instead of the beginning, or for scheduling around holidays when a process is still required to run on the holiday, but not the day after the holiday.
The after schedule differs from the DayAfterSchedule
in that
day-after is designed to narrow it's parent interval but this schedule
applies a refinement to it child schedule. The difference is subtle
but hopefully the examples demonstrate how each should be used.
<schedules:count count="1" xmlns:schedules="http://rgordon.co.uk/oddjob/schedules"> <refinement> <schedules:after> <schedule> <schedules:interval interval="00:20"/> </schedule> </schedules:after> </refinement> </schedules:count>This would schedule a job to run once after 20 minutes. It could be used to stop a long running job for instance.
<schedules:after xmlns:schedules="http://rgordon.co.uk/oddjob/schedules"> <schedule> <schedules:broken> <schedule> <schedules:weekly from="MONDAY" to="FRIDAY"> <refinement> <schedules:daily/> </refinement> </schedules:weekly> </schedule> <breaks> <schedules:date on="2011-05-02"/> </breaks> </schedules:broken> </schedule> <refinement> <schedules:time from="08:00"/> </refinement> </schedules:after>Normally this will schedule something from 08:00 am Tuesday to Saturday, but for the week where Monday 2nd of May was a public holiday the schedule will be from Wednesday to Saturday.
Constructor and Description |
---|
AfterSchedule() |
Modifier and Type | Method and Description |
---|---|
Schedule |
getSchedule() |
ScheduleResult |
nextDue(ScheduleContext context)
For a given date a schedule will provide the interval this schedule
should next be scheduled in.
|
void |
setSchedule(Schedule schedule) |
getRefinement, setRefinement
public ScheduleResult nextDue(ScheduleContext context)
Schedule
If the schedule is never due again for the given date, null is returned.
public Schedule getSchedule()
public void setSchedule(Schedule schedule)