org.apache.sling.commons.scheduler
Interface ScheduleOptions

All Known Implementing Classes:
InternalScheduleOptions

public interface ScheduleOptions

Scheduler options provide an extensible way of defining how to schedule a job. An option can be created via the scheduler.

Since:
2.3

Method Summary
 ScheduleOptions canRunConcurrently(boolean flag)
          Flag indicating whether the job can be run concurrently.
 ScheduleOptions config(Map<String,Serializable> config)
          Add optional configuration for the job.
 ScheduleOptions name(String name)
          Sets the name of the job.
 ScheduleOptions onInstancesOnly(String[] slingIds)
          List of Sling IDs this job should be run on.
 ScheduleOptions onLeaderOnly(boolean flag)
          Flag indicating whether the job should only be run on the leader.
 ScheduleOptions onSingleInstanceOnly(boolean flag)
          Flag indicating whether the job should only be run on a single instance in a cluster This defaults to false.
 

Method Detail

config

ScheduleOptions config(Map<String,Serializable> config)
Add optional configuration for the job.

Parameters:
config - An optional configuration object - this configuration is only passed to the job the job implements Job.

name

ScheduleOptions name(String name)
Sets the name of the job. A job only needs a name if it is scheduled and should be cancelled later on. The name can then be used to cancel the job. If a second job with the same name is started, the second one replaces the first one.

Parameters:
name - The job name

canRunConcurrently

ScheduleOptions canRunConcurrently(boolean flag)
Flag indicating whether the job can be run concurrently. This defaults to false.

Parameters:
flag - Whether this job can run even if previous scheduled runs are still running.

onLeaderOnly

ScheduleOptions onLeaderOnly(boolean flag)
Flag indicating whether the job should only be run on the leader. This defaults to false. If no topology information is available (= no Apache Sling Discovery Implementation active) this flag is ignored and the job is run on all instances! If onSingleInstanceOnly(boolean) or onInstancesOnly(String[]) has been called before, that option is reset and overwritten by the value of this method.

Parameters:
flag - Whether this job should only be run on the leader

onSingleInstanceOnly

ScheduleOptions onSingleInstanceOnly(boolean flag)
Flag indicating whether the job should only be run on a single instance in a cluster This defaults to false. If no topology information is available (= no Apache Sling Discovery Implementation active) this flag is ignored and the job is run on all instances! If onLeaderOnly(boolean) or onInstancesOnly(String[]) has been called before, that option is reset and overwritten by the value of this method.

Parameters:
flag - Whether this job should only be run on a single instance.

onInstancesOnly

ScheduleOptions onInstancesOnly(String[] slingIds)
List of Sling IDs this job should be run on. If no topology information is available (= no Apache Sling Discovery Implementation active) this flag is ignored and the job is run on all instances! If onLeaderOnly(boolean) or onSingleInstanceOnly(boolean) has been called before, that option is reset and overwritten by the value of this method.

Parameters:
slingIds - Array of Sling IDs this job should run on


Copyright © 2007-2013 The Apache Software Foundation. All Rights Reserved.