See: Description
Interface | Description |
---|---|
ISchedulerEntry |
Scheduler entries contain data for scheduler tasks.
|
ISchedulerEntryFactory | Deprecated
since KM5.0SP6.
|
ISchedulerEntryList | Deprecated
since KM 5.0 SP6
|
ISchedulerEntryListIterator | Deprecated
since KM 5.0 SP6
|
ISchedulerService |
The scheduler service for the WCM.
|
ISchedulerTask |
The task to be run by the scheduler.
|
ISchedulerTime |
The times for a scheduler.
|
ISchedulerTimeList | Deprecated
since KM6.0SP1.
|
ISchedulerTimeListIterator | Deprecated
since KM5.0SP6.
|
ISchedulerTimeTable |
Timetables for the scheduler.
|
ISequence |
Specifies a sequence of scheduler entries.
|
Class | Description |
---|---|
SchedulerServiceFactory |
Service factory for the service of this package.
|
Provides a service that controls the execution of tasks.
Purpose
Detailed Concept
Interfaces and Classes
Code Samples
Configuration
Implementation Notes
The scheduler is a service that manages the execution of tasks for applications. An application can register a task at the scheduler and specify a time when it must be performed. The scheduler then ensures that the task is started at the right time and monitors its execution.
The service is particularly useful for tasks that have to be performed regularly. For example, the subscription service uses the scheduler to ensure that directories containing relevant documents are crawled at regular intervals.
In the following, a scheduled task that has to be performed at a specific time is called a job.
The scheduler offers two types of support. It triggers the execution of jobs at the time when they are scheduled and, in addition, manages all the jobs that are registered for execution. This means it is responsible for registering, modifying, monitoring and deleting jobs. When it monitors the status of running jobs, it can stop, suspend or resume jobs. If several jobs are scheduled to run at the same time, it checks their priority and decides which one should be executed first.
From a technical perspective, the scheduler is an implementation of the ISchedulerService interface. The interface provides methods to manage a list of jobs and to start each one at a predefined time. Each job in the list is defined with the help of an ISchedulerEntry object which stores the essential information about the job. This includes:
Note:
If a CM system is part of a
cluster installation, at least one CM system must be selected in the
list of CM systems. If the list is empty, the scheduler does not
perform the task. If one or ore systems are selected, the
scheduler services of all listed systems will perform the task.
If the CM system is not clustered,
the scheduler performs the task, no matter if the list is empty or not.
The scheduler regularly checks whether any of the jobs that it is responsible for have to be executed. For this reason it must be able to continuously access information about all registered jobs and their execution time.
The main interfaces of the scheduler service are:
The diagram shows the interfaces described above:
If an application wants to use the scheduler service, it can access most of the available functions via the ISchedulerService interface. However, in addition, it must define the task that is to be executed by implementing the ISchedulerTask interface. In summary, an application that wants to use the scheduler must:
The code sample schedules a task to run every hour:
ISchedulerService service = ResourceFactory.getInstance().getServiceFactory().getService(IServiceTypesConst.SCHEDULER_SERVICE );
ISchedulerTimeTable timeTable = service.createTimeTable();
ISchedulerTime time = service.createTimeWildcard();
// start every hour
time.set( Calendar.HOUR_OF_DAY, 1 );
time.set( Calendar.MINUTE, 0 );
timeTable.addToTable( time );
Properties properties = new Properties();
properties.setProperty( "rid", "sampleURI" );
service.createSchedulerEntry("sampleID", 1, new SchedulerTaskExample(), timeTable, properties );
The scheduler can be configured with the parameters shown in the
table.
The parameters can be set with the help of the user interface of the
Content Management configuration framework.
For more information, see the documentation Administering Content
Management.
The parameters in the table that are not required have
default
values that are used if no value is specified.
Parameter | Required | Description |
entries | yes/no | A list of ISchedulerEntry objects |
Parameter | Required | Description |
name | yes | The unique ID of this entry |
priority | yes | The priority of the task |
timetable | no | An
com.sapportals.wcm.service.scheduler.ITimeTable object |
task | yes | An
ISchedulerTask
implementation. |
cmsystems | no | A list of possible CM Systems where the task can be executed when running in a cluster |
properties | no | A
set of properties depending on the ISchedulerTask implementation. |
Parameter | Required | Description |
year | no | The year between 2000 and 2025. No setting means every year. |
month | no | The month between 1 and 12. No setting means every month. |
weekofmonth | no | The week of the month between 1 and 5. |
monthday | no | The day of the month (when this property overrides the weekofmonth setting ) |
weekday | no | The day of the week from 1 (Monday) to 7 (Sunday) |
hour | no | The hour of the day between 0 and 23. |
minute | no | The minute of an hour between 0 and 59. No setting means every minute. |
cmsystems | no | A list of CM Systems where the task can be executed in a cluster at the specified time. The list must be a subset of the list of CM systems in the assigned scheduler entry object. |
The following settings show schedule entry that triggers the execution of the task once a year, every full hour on the first Sunday in May. If no parameters are set in the scheduler entry, the task runs every minute.
Parameter | Value |
month | 5 (May) |
weekofmonth | 1 |
weekday | 7 (Sunday) |
minute | 0 |
The sequence diagram shows the actions that are necessary to schedule a task.
Note that the scheduler uses the configuration framework as its persistence layer. All entries created at runtime can be edited via the user interface of the configuration framework.
Copyright 2018 SAP AG Complete Copyright Notice