If Oddjob is running with a persister missed executions fire immediately one after the other until all missed executions have run.
This can be overridden with the skipMissedRuns property.
If a timer is started after the initial execution time but within the interval of the schedule - execution will happen immediately. Extended intervals are created using the from properties instead of the at/in/on properties of schedules.
| clock | The clock to use. |
| current | This is the current/next result from the schedule. |
| haltOnFailure | Don't reschedule if the scheduled job doesn't complete. |
| job | The job to run when it's due. |
| lastDue | The time the schedule was lastDue. |
| name | A name, can be any text. |
| nextDue | The time the next execution is due. |
| schedule | The Schedule used to provide execution times. |
| skipMissedRuns | Use the current time, not the last completed time to calculate when the job is next due. |
| timeZone | The time zone the schedule is to run in. |
| Example 1 | A Timer that runs at 10am each day, Monday to Friday. |
| Example 2 | Run once at 10am or any time after. |
| Example 3 | Use a timer to stop a long running job. |
| Configured By | ELEMENT |
| Access | READ_WRITE |
| Required | Set automatically. |
The clock to use. Tells the current time.
| Access | READ_ONLY |
| Required | Set automatically. |
This is the current/next result from the schedule. This properties fromDate is used to set the nextDue date for the schedule and it's useNext (normally the same as toDate) property is used to calculate the following new current property after execution. This property is most useful for the Timer to pass limits to the Retry, but is also useful for diagnostics.
| Configured By | ATTRIBUTE |
| Access | READ_WRITE |
| Required | No. |
Don't reschedule if the scheduled job doesn't complete.
| Configured By | ELEMENT |
| Access | WRITE_ONLY |
| Required | Yes. |
The job to run when it's due.
| Access | READ_ONLY |
| Required | Read only. |
The time the schedule was lastDue. This is set from the nextDue property when the job begins to execute.
| Configured By | ATTRIBUTE |
| Access | READ_WRITE |
| Required | No. |
A name, can be any text.
| Access | READ_ONLY |
| Required | Read Only. |
The time the next execution is due. This property is updated when the timer starts or after each execution.
| Configured By | ELEMENT |
| Access | READ_WRITE |
| Required | Yes. |
The Schedule used to provide execution times.
| Configured By | ATTRIBUTE |
| Access | READ_WRITE |
| Required | No. |
Use the current time, not the last completed time to calculate when the job is next due.
| Configured By | ATTRIBUTE |
| Access | READ_WRITE |
| Required | Set automatically. |
The time zone the schedule is to run in. This is the text id of the time zone, such as "Europe/London". More information can be found at TimeZone.
A Timer that runs at 10am each day, Monday to Friday.
<oddjob>
<job>
<scheduling:timer id="timer" xmlns:scheduling="http://rgordon.co.uk/oddjob/scheduling" xmlns:schedules="http://rgordon.co.uk/oddjob/schedules">
<schedule>
<schedules:weekly from="Monday" to="Friday">
<refinement>
<schedules:daily at="10:00"/>
</refinement>
</schedules:weekly>
</schedule>
<job>
<echo id="work">Doing some work at ${timer.current.fromDate}</echo>
</job>
</scheduling:timer>
</job>
</oddjob>
Run once at 10am or any time after.
<oddjob>
<job>
<sequential>
<jobs>
<echo id="big-report" name="Pretend this is a Long Running Report">Meaning of Life: 42</echo>
<scheduling:timer id="timer" xmlns:scheduling="http://rgordon.co.uk/oddjob/scheduling">
<schedule>
<schedules:time from="10:00" xmlns:schedules="http://rgordon.co.uk/oddjob/schedules"/>
</schedule>
<job>
<echo name="Pretend this Forwards the Long Running Report">Emailing: ${big-report.text}</echo>
</job>
</scheduling:timer>
</jobs>
</sequential>
</job>
</oddjob>
If the report completes before 10am the timer will schedule it to be e-mailed
at 10am. If the report completes after 10am it is e-mailed immediately.
Use a timer to stop a long running job.
<oddjob>
<job>
<sequential id="main" name="Stop Overdue Job">
<jobs>
<scheduling:timer xmlns:scheduling="http://rgordon.co.uk/oddjob/scheduling">
<schedule>
<schedules:count count="1" xmlns:schedules="http://rgordon.co.uk/oddjob/schedules">
<refinement>
<schedules:after>
<schedule>
<schedules:interval interval="00:00:10"/>
</schedule>
</schedules:after>
</refinement>
</schedules:count>
</schedule>
<job>
<stop job="${long-job}" name="Stop Long Running Job"/>
</job>
</scheduling:timer>
<wait id="long-job" name="A Long Running Job"/>
</jobs>
</sequential>
</job>
</oddjob>
The job will be stopped after 10 seconds. If the job has already completed
the stop will have no affect.