|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.sling.commons.scheduler.impl.QuartzScheduler
@Service(value=Scheduler.class) public class QuartzScheduler
The quartz based implementation of the scheduler.
| Nested Class Summary | |
|---|---|
static class |
QuartzScheduler.QuartzThreadPool
|
| Field Summary |
|---|
| Fields inherited from interface org.apache.sling.commons.scheduler.Scheduler |
|---|
PROPERTY_SCHEDULER_CONCURRENT, PROPERTY_SCHEDULER_EXPRESSION, PROPERTY_SCHEDULER_IMMEDIATE, PROPERTY_SCHEDULER_NAME, PROPERTY_SCHEDULER_PERIOD, PROPERTY_SCHEDULER_RUN_ON, VALUE_RUN_ON_LEADER, VALUE_RUN_ON_SINGLE |
| Constructor Summary | |
|---|---|
QuartzScheduler()
|
|
| Method Summary | |
|---|---|
protected void |
activate(org.osgi.framework.BundleContext ctx,
Map<String,Object> props)
Activate this component. |
void |
addJob(String name,
Object job,
Map<String,Serializable> config,
String schedulingExpression,
boolean canRunConcurrently)
/** Schedule a time based job. |
void |
addPeriodicJob(String name,
Object job,
Map<String,Serializable> config,
long period,
boolean canRunConcurrently)
Schedule a periodic job. |
void |
addPeriodicJob(String name,
Object job,
Map<String,Serializable> config,
long period,
boolean canRunConcurrently,
boolean startImmediate)
Schedule a periodic job. |
ScheduleOptions |
AT(Date date)
Create a schedule options to fire a job once at a specific date |
ScheduleOptions |
AT(Date date,
int times,
long period)
Create a schedule options to fire a job period starting at a specific date |
protected void |
deactivate()
Deactivate this component. |
ScheduleOptions |
EXPR(String expression)
Create a schedule options to schedule the job based on the expression |
void |
fireJob(Object job,
Map<String,Serializable> config)
Fire a job immediately and only once. |
boolean |
fireJob(Object job,
Map<String,Serializable> config,
int times,
long period)
Fire a job immediately more than once. |
void |
fireJobAt(String name,
Object job,
Map<String,Serializable> config,
Date date)
Fire a job once at a specific date Note that if a job with the same name has already been added, the old job is cancelled and this new job replaces the old job. |
boolean |
fireJobAt(String name,
Object job,
Map<String,Serializable> config,
Date date,
int times,
long period)
Fire a job once at a specific date, several times with a given interval. |
ScheduleOptions |
NOW()
Create a schedule options to fire a job immediately and only once. |
ScheduleOptions |
NOW(int times,
long period)
Create a schedule options to fire a job immediately more than once. |
void |
removeJob(String name)
Remove a scheduled job by name. |
boolean |
schedule(Object job,
ScheduleOptions options)
Schedule a job based on the options. |
boolean |
unschedule(String jobName)
Remove a scheduled job by name. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public QuartzScheduler()
| Method Detail |
|---|
@Activate
protected void activate(org.osgi.framework.BundleContext ctx,
Map<String,Object> props)
throws Exception
Exception@Deactivate protected void deactivate()
public void addJob(String name,
Object job,
Map<String,Serializable> config,
String schedulingExpression,
boolean canRunConcurrently)
throws org.quartz.SchedulerException
Scheduler
addJob in interface Schedulername - The name of the job - or null. If no name is specified it can't be cancelled.job - The job to execute (either Job or Runnable).config - An optional configuration object - this configuration is only passed to the job the job implements Job.schedulingExpression - The time specification using a scheduling expression.canRunConcurrently - Whether this job can run even if previous scheduled runs are still running.
org.quartz.SchedulerExceptionScheduler.addJob(java.lang.String, java.lang.Object, java.util.Map, java.lang.String, boolean)
public void addPeriodicJob(String name,
Object job,
Map<String,Serializable> config,
long period,
boolean canRunConcurrently)
throws org.quartz.SchedulerException
Scheduler
addPeriodicJob in interface Schedulername - The name of the job - or null. If no name is specified it can't be cancelled.job - The job to execute (either Job or Runnable).config - An optional configuration object - this configuration is only passed to the job the job implements Job.period - Every period seconds this job is started.canRunConcurrently - Whether this job can run even if previous scheduled runs are still running.
org.quartz.SchedulerExceptionScheduler.addPeriodicJob(java.lang.String, java.lang.Object, java.util.Map, long, boolean)
public void addPeriodicJob(String name,
Object job,
Map<String,Serializable> config,
long period,
boolean canRunConcurrently,
boolean startImmediate)
throws org.quartz.SchedulerException
Scheduler
addPeriodicJob in interface Schedulername - The name of the job - or null. If no name is specified it can't be cancelled.job - The job to execute (either Job or Runnable).config - An optional configuration object - this configuration is only passed to the job the job implements Job.period - Every period seconds this job is started.canRunConcurrently - Whether this job can run even if previous scheduled runs are still running.startImmediate - Whether to start the job immediately for the first time or wait for the period to expire.
org.quartz.SchedulerExceptionScheduler.addPeriodicJob(java.lang.String, java.lang.Object, java.util.Map, long, boolean, boolean)
public void fireJob(Object job,
Map<String,Serializable> config)
throws org.quartz.SchedulerException
Scheduler
fireJob in interface Schedulerjob - The job to execute (either Job or Runnable).config - An optional configuration object - this configuration is only passed to the job the job implements Job.
org.quartz.SchedulerExceptionScheduler.fireJob(java.lang.Object, java.util.Map)
public void fireJobAt(String name,
Object job,
Map<String,Serializable> config,
Date date)
throws org.quartz.SchedulerException
Scheduler
fireJobAt in interface Schedulername - The name of the job - or null. If no name is specified it can't be cancelled.job - The job to execute (either Job or Runnable).config - An optional configuration object - this configuration is only passed to the job the job implements Job.date - The date this job should be run.
org.quartz.SchedulerExceptionScheduler.fireJobAt(java.lang.String, java.lang.Object, java.util.Map, java.util.Date)
public boolean fireJob(Object job,
Map<String,Serializable> config,
int times,
long period)
Scheduler
fireJob in interface Schedulerjob - The job to execute (either Job or Runnable).config - An optional configuration object - this configuration is only passed to the job the job implements Job.times - The number of times this job should be started (must be higher than 1)period - Every period seconds this job is started.
Scheduler.fireJob(java.lang.Object, java.util.Map, int, long)
public boolean fireJobAt(String name,
Object job,
Map<String,Serializable> config,
Date date,
int times,
long period)
Scheduler
fireJobAt in interface Schedulername - The name of the job - or null. If no name is specified it can't be cancelled.job - The job to execute (either Job or Runnable).config - An optional configuration object - this configuration is only passed to the job the job implements Job.date - The date this job should be run.times - The number of times this job should be started (must be higher than 1)period - Every period seconds this job is started.
Scheduler.fireJobAt(java.lang.String, java.lang.Object, java.util.Map, java.util.Date, int, long)
public void removeJob(String name)
throws NoSuchElementException
Scheduler
removeJob in interface Schedulername - The name of the job.
NoSuchElementException - If the job is not scheduled.Scheduler.removeJob(java.lang.String)public ScheduleOptions NOW()
Scheduler
NOW in interface SchedulerScheduler.NOW()
public ScheduleOptions NOW(int times,
long period)
Scheduler
NOW in interface Schedulertimes - The number of times this job should be started (must be higher than 1 or
-1 for endless)period - Every period seconds this job is started (must be at higher than 0).Scheduler.NOW(int, long)public ScheduleOptions AT(Date date)
Scheduler
AT in interface Schedulerdate - The date this job should be run.Scheduler.AT(java.util.Date)
public ScheduleOptions AT(Date date,
int times,
long period)
Scheduler
AT in interface Schedulerdate - The date this job should be run.times - The number of times this job should be started (must be higher than 1 or
-1 for endless)period - Every period seconds this job is started (must be at higher than 0).Scheduler.AT(java.util.Date, int, long)public ScheduleOptions EXPR(String expression)
Scheduler
EXPR in interface Schedulerexpression - The cron exceptionScheduler.EXPR(java.lang.String)
public boolean schedule(Object job,
ScheduleOptions options)
SchedulerJob or a Runnable. The options have to be created
by one of the provided methods from this scheduler.
schedule in interface Schedulerjob - The job to execute (either Job or Runnable).options - Required options defining how to schedule the job
Scheduler.schedule(java.lang.Object, org.apache.sling.commons.scheduler.ScheduleOptions)public boolean unschedule(String jobName)
Scheduler
unschedule in interface Schedulertrue if the job existed and could be stopped, false otherwise.Scheduler.unschedule(java.lang.String)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||