org.apache.sling.commons.scheduler.impl
Class InternalScheduleOptions

java.lang.Object
  extended by org.apache.sling.commons.scheduler.impl.InternalScheduleOptions
All Implemented Interfaces:
ScheduleOptions

public class InternalScheduleOptions
extends Object
implements ScheduleOptions

Scheduler options provide an extensible way of defining how to schedule a job.

Since:
2.3

Field Summary
 IllegalArgumentException argumentException
           
 boolean canRunConcurrently
           
 Map<String,Serializable> configuration
           
 String name
           
 String[] runOn
           
 org.quartz.TriggerBuilder<? extends org.quartz.Trigger> trigger
           
 
Constructor Summary
InternalScheduleOptions(IllegalArgumentException iae)
           
InternalScheduleOptions(org.quartz.TriggerBuilder<? extends org.quartz.Trigger> trigger)
           
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

public String name

canRunConcurrently

public boolean canRunConcurrently

configuration

public Map<String,Serializable> configuration

trigger

public final org.quartz.TriggerBuilder<? extends org.quartz.Trigger> trigger

argumentException

public final IllegalArgumentException argumentException

runOn

public String[] runOn
Constructor Detail

InternalScheduleOptions

public InternalScheduleOptions(org.quartz.TriggerBuilder<? extends org.quartz.Trigger> trigger)

InternalScheduleOptions

public InternalScheduleOptions(IllegalArgumentException iae)
Method Detail

config

public ScheduleOptions config(Map<String,Serializable> config)
Description copied from interface: ScheduleOptions
Add optional configuration for the job.

Specified by:
config in interface ScheduleOptions
Parameters:
config - An optional configuration object - this configuration is only passed to the job the job implements Job.
See Also:
ScheduleOptions.config(java.util.Map)

name

public ScheduleOptions name(String name)
Description copied from interface: ScheduleOptions
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.

Specified by:
name in interface ScheduleOptions
Parameters:
name - The job name
See Also:
ScheduleOptions.name(java.lang.String)

canRunConcurrently

public ScheduleOptions canRunConcurrently(boolean flag)
Description copied from interface: ScheduleOptions
Flag indicating whether the job can be run concurrently. This defaults to false.

Specified by:
canRunConcurrently in interface ScheduleOptions
Parameters:
flag - Whether this job can run even if previous scheduled runs are still running.
See Also:
ScheduleOptions.canRunConcurrently(boolean)

onLeaderOnly

public ScheduleOptions onLeaderOnly(boolean flag)
Description copied from interface: ScheduleOptions
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 ScheduleOptions.onSingleInstanceOnly(boolean) or ScheduleOptions.onInstancesOnly(String[]) has been called before, that option is reset and overwritten by the value of this method.

Specified by:
onLeaderOnly in interface ScheduleOptions
Parameters:
flag - Whether this job should only be run on the leader
See Also:
ScheduleOptions.onLeaderOnly(boolean)

onSingleInstanceOnly

public ScheduleOptions onSingleInstanceOnly(boolean flag)
Description copied from interface: ScheduleOptions
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 ScheduleOptions.onLeaderOnly(boolean) or ScheduleOptions.onInstancesOnly(String[]) has been called before, that option is reset and overwritten by the value of this method.

Specified by:
onSingleInstanceOnly in interface ScheduleOptions
Parameters:
flag - Whether this job should only be run on a single instance.
See Also:
ScheduleOptions.onSingleInstanceOnly(boolean)

onInstancesOnly

public ScheduleOptions onInstancesOnly(String[] slingIds)
Description copied from interface: ScheduleOptions
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 ScheduleOptions.onLeaderOnly(boolean) or ScheduleOptions.onSingleInstanceOnly(boolean) has been called before, that option is reset and overwritten by the value of this method.

Specified by:
onInstancesOnly in interface ScheduleOptions
Parameters:
slingIds - Array of Sling IDs this job should run on
See Also:
ScheduleOptions.onInstancesOnly(java.lang.String[])


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