|
||||||||||
| 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)
@References(value={@Reference(name="job",referenceInterface=Job.class,cardinality=OPTIONAL_MULTIPLE,policy=DYNAMIC),@Reference(name="task",referenceInterface=java.lang.Runnable.class,cardinality=OPTIONAL_MULTIPLE,policy=DYNAMIC)})
public class QuartzSchedulerThe quartz based implementation of the scheduler.
| Nested Class Summary | |
|---|---|
static class |
QuartzScheduler.QuartzThreadPool
|
| Field Summary | |
|---|---|
protected org.osgi.service.component.ComponentContext |
context
The component context. |
protected static java.lang.String |
DEFAULT_QUARTZ_JOB_GROUP
|
protected org.slf4j.Logger |
logger
Default log. |
protected static java.lang.String |
PREFIX
|
protected static java.lang.String |
QUARTZ_SCHEDULER_NAME
|
protected java.util.List<org.apache.sling.commons.scheduler.impl.QuartzScheduler.Registration> |
registeredJobs
List of registrations while this service is not activated yet. |
protected org.quartz.Scheduler |
scheduler
Theq quartz scheduler. |
protected org.apache.sling.commons.threads.ThreadPool |
threadPool
|
protected org.apache.sling.commons.threads.ThreadPoolManager |
threadPoolManager
|
| 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 |
| Constructor Summary | |
|---|---|
QuartzScheduler()
|
|
| Method Summary | |
|---|---|
protected void |
activate(org.osgi.service.component.ComponentContext ctx)
Activate this component. |
void |
addJob(java.lang.String name,
java.lang.Object job,
java.util.Map<java.lang.String,java.io.Serializable> config,
java.lang.String schedulingExpression,
boolean canRunConcurrently)
Schedule a time based job. |
void |
addPeriodicJob(java.lang.String name,
java.lang.Object job,
java.util.Map<java.lang.String,java.io.Serializable> config,
long period,
boolean canRunConcurrently)
Schedule a periodic job. |
void |
addPeriodicJob(java.lang.String name,
java.lang.Object job,
java.util.Map<java.lang.String,java.io.Serializable> config,
long period,
boolean canRunConcurrently,
boolean startImmediate)
Schedule a periodic job. |
protected void |
bindJob(org.osgi.framework.ServiceReference ref)
Bind a new job. |
protected void |
bindTask(org.osgi.framework.ServiceReference ref)
Bind a new task. |
protected void |
checkJob(java.lang.Object job)
Check the job object, either runnable or job is allowed |
protected org.quartz.JobDetail |
createJobDetail(java.lang.String name,
org.quartz.JobDataMap jobDataMap,
boolean concurrent)
Create the job detail. |
protected void |
deactivate(org.osgi.service.component.ComponentContext ctx)
Deactivate this component. |
protected void |
dispose(org.quartz.Scheduler s)
Dispose the quartz scheduler |
void |
fireJob(java.lang.Object job,
java.util.Map<java.lang.String,java.io.Serializable> config)
Fire a job immediately and only once. |
boolean |
fireJob(java.lang.Object job,
java.util.Map<java.lang.String,java.io.Serializable> config,
int times,
long period)
Fire a job immediately more than once. |
void |
fireJobAt(java.lang.String name,
java.lang.Object job,
java.util.Map<java.lang.String,java.io.Serializable> config,
java.util.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(java.lang.String name,
java.lang.Object job,
java.util.Map<java.lang.String,java.io.Serializable> config,
java.util.Date date,
int times,
long period)
Fire a job once at a specific date, several times with a given interval. |
protected org.quartz.Scheduler |
init(java.lang.String poolName)
Initialize the quartz scheduler |
protected org.quartz.JobDataMap |
initDataMap(java.lang.String jobName,
java.lang.Object job,
java.util.Map<java.lang.String,java.io.Serializable> config)
Initialize the data map for the job executor. |
void |
removeJob(java.lang.String name)
Remove a scheduled job by name. |
protected void |
scheduleJob(java.lang.String name,
java.lang.Object job,
java.util.Map<java.lang.String,java.io.Serializable> config,
org.quartz.Trigger trigger,
boolean canRunConcurrently)
Add a job to the scheduler |
protected void |
unbindJob(org.osgi.framework.ServiceReference ref)
Unbind a job. |
protected void |
unbindTask(org.osgi.framework.ServiceReference ref)
Unbind a task. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final org.slf4j.Logger logger
protected static final java.lang.String DEFAULT_QUARTZ_JOB_GROUP
protected static final java.lang.String PREFIX
protected static final java.lang.String QUARTZ_SCHEDULER_NAME
protected volatile org.quartz.Scheduler scheduler
protected final java.util.List<org.apache.sling.commons.scheduler.impl.QuartzScheduler.Registration> registeredJobs
protected volatile org.osgi.service.component.ComponentContext context
@Reference protected org.apache.sling.commons.threads.ThreadPoolManager threadPoolManager
protected org.apache.sling.commons.threads.ThreadPool threadPool
| Constructor Detail |
|---|
public QuartzScheduler()
| Method Detail |
|---|
protected void activate(org.osgi.service.component.ComponentContext ctx)
throws java.lang.Exception
ctx - The component context.
java.lang.Exceptionprotected void deactivate(org.osgi.service.component.ComponentContext ctx)
ctx - The component context.
protected org.quartz.Scheduler init(java.lang.String poolName)
throws org.quartz.SchedulerException
org.quartz.SchedulerExceptionprotected void dispose(org.quartz.Scheduler s)
s - The scheduler.
protected void scheduleJob(java.lang.String name,
java.lang.Object job,
java.util.Map<java.lang.String,java.io.Serializable> config,
org.quartz.Trigger trigger,
boolean canRunConcurrently)
throws org.quartz.SchedulerException
name - The name of the job to add (or null)Tje - jopbtrigger - a TriggercanRunConcurrently - whether this job can be run concurrently
org.quartz.SchedulerException - thrown in case of errors
protected org.quartz.JobDataMap initDataMap(java.lang.String jobName,
java.lang.Object job,
java.util.Map<java.lang.String,java.io.Serializable> config)
jobName - job - config - concurent -
protected org.quartz.JobDetail createJobDetail(java.lang.String name,
org.quartz.JobDataMap jobDataMap,
boolean concurrent)
name - jobDataMap -
protected void checkJob(java.lang.Object job)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public void addJob(java.lang.String name,
java.lang.Object job,
java.util.Map<java.lang.String,java.io.Serializable> config,
java.lang.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(java.lang.String name,
java.lang.Object job,
java.util.Map<java.lang.String,java.io.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(java.lang.String name,
java.lang.Object job,
java.util.Map<java.lang.String,java.io.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(java.lang.Object job,
java.util.Map<java.lang.String,java.io.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(java.lang.String name,
java.lang.Object job,
java.util.Map<java.lang.String,java.io.Serializable> config,
java.util.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(java.lang.Object job,
java.util.Map<java.lang.String,java.io.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(java.lang.String name,
java.lang.Object job,
java.util.Map<java.lang.String,java.io.Serializable> config,
java.util.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(java.lang.String name)
throws java.util.NoSuchElementException
Scheduler
removeJob in interface Schedulername - The name of the job.
java.util.NoSuchElementException - If the job is not scheduled.Scheduler.removeJob(java.lang.String)protected void bindJob(org.osgi.framework.ServiceReference ref)
ref -
java.lang.Exceptionprotected void unbindJob(org.osgi.framework.ServiceReference ref)
ref - protected void bindTask(org.osgi.framework.ServiceReference ref)
ref -
java.lang.Exceptionprotected void unbindTask(org.osgi.framework.ServiceReference ref)
ref -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||