Recurring Tasks
Recurring tasks are the most common tasks. They can be configured to start up, start at a given date and time, and repeat every fixed number of time intervals. A starting date and time is not necessary and, if unspecified, the task starts sequencing as soon as the Transaction Server is started.
<TASK>
<NAME>Good Afternoon User</NAME>
<EXEC>
com.ibm.icpcs.transactionserver.scheduler.ScheduledTaskSample
</EXEC>
<INFO>My recurring task. 10-26-2020</INFO>
<TIMER type="repeating">
<INTERVAL>1 hr</INTERVAL>
<STARTING>12:00 pm</STARTING>
</TIMER>
</TASK>This task runs in the foreground because the background="yes" attribute is not specified for the task tag. The default operation is foreground, unless otherwise specified.
Several tasks are included in the Transaction Server, but are not configured by default. To use one of these tasks, the class name specified in the configuration file must exactly match the class name given here. User implemented tasks may have package and class names different from those mentioned below.
The <INFO> tag is optional and is useful if you are overriding a task that
is configured by default. The information specified in this tag is presented during Transaction Server startup as the tasks are being enabled and can be used to uniquely identify that
your version of the task is the one being configured.
The <TIMER> tag is used to specify when the task is to be scheduled. To
specify a recurring task, set the type attribute to repeating. For a one-time scheduled task, set
this attribute to single.
<TIMER> tag are two more tags:
<INTERVAL> and <STARTING>. The
<INTERVAL> tag is required for a repeating timer and specifies the time
interval between tasks. Intervals can be specified as shown in Table 1.
| Interval Time Unit | Valid Codings | Minimum Length |
|---|---|---|
| milliseconds |
msecs
milliseconds millisecs |
4
8 8 |
| seconds |
secs
seconds |
3
3 |
| minutes |
mins
minutes |
3
3 |
| hours |
hrs
hours |
2
4 |
| days | days | 3 |
| business days |
bdays
busdays bus days businessdays business days |
4
6 7 11 12 |
In the example, the interval is specified as 1 hr or 1 hour between task
executions.
Note there is a distinction between days and business days. Use
days to specify a time interval spanning a number of days, regardless of when those days
occur. Use business days to specify a time interval where only weekdays that are not
configured as holidays are counted in the time span. For more information regarding how business day
calculations are done, see Holiday Support.
The <STARTING> tag is optional and is used to specify the date and time at
which the first invocation of the task is to take place. If omitted, the task starts on the first
interval expiration time. Dates are specified in standard three-segment format MM/DD/YY (for
example, May 28, 2003 is specified as 05/28/03). Times are specified in 12-hour mode with AM and PM
indicators as shown in the example. If a date and time are specified together, the date must come
first, followed by a space and followed by the time. Note the AM and PM indicator must be separated
from the time value by a space.
If only a date is specified, the time defaults to midnight at the start of that day. If only a time is specified, the date that the Transaction Server is started is presumed. If the Transaction Server is started before the date or time is reached, the first invocation of the task does not occur until the starting date or time is reached. If the Transaction Server is started after the specified starting date or time, the first invocation occurs on the first repeating interval that occurs after the start time. In our example, if the Transaction Server is started at 9:16 AM, the first invocation occurs at 12:00 PM (noon) as specified. If the Transaction Server is started at 3:44 PM, the first invocation occurs at 4:00 PM (the first full hour afterward).