|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Scheduler
A scheduler to schedule time/cron based jobs.
A job is an object which is executed/fired by the scheduler. The object
should either implement the Job
interface or the Runnable
interface.
Field Summary | |
---|---|
static String |
PROPERTY_SCHEDULER_CONCURRENT
Name of the configuration property to define if the job can be run concurrently. |
static String |
PROPERTY_SCHEDULER_EXPRESSION
Name of the configuration property to define the cron expression for a job. |
static String |
PROPERTY_SCHEDULER_NAME
Name of the configuration property to define the job name. |
static String |
PROPERTY_SCHEDULER_PERIOD
Name of the configuration property to define the period for a job. |
Method Summary | |
---|---|
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 |
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 beed 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. |
void |
removeJob(String name)
Remove a scheduled job by name. |
Field Detail |
---|
static final String PROPERTY_SCHEDULER_PERIOD
static final String PROPERTY_SCHEDULER_EXPRESSION
static final String PROPERTY_SCHEDULER_CONCURRENT
static final String PROPERTY_SCHEDULER_NAME
Method Detail |
---|
void addJob(String name, Object job, Map<String,Serializable> config, String schedulingExpression, boolean canRunConcurrently) throws Exception
name
- 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.
IllegalArgumentException
- If the scheduling expression can't be parsed or if the job has not the correct type.
Exception
- If the job can't be scheduled.void addPeriodicJob(String name, Object job, Map<String,Serializable> config, long period, boolean canRunConcurrently) throws Exception
name
- 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.
IllegalArgumentException
- If the job has not the correct type.
Exception
- If the job can't be scheduled.void fireJob(Object job, Map<String,Serializable> config) throws Exception
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
.
IllegalArgumentException
- If the job has not the correct type.
Exception
- If the job can't be scheduled.boolean fireJob(Object job, Map<String,Serializable> config, int times, long period)
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
.times
- The number of times this job should be started (must be higher than 1)period
- Every period seconds this job is started.
IllegalArgumentException
- If the job has not the correct type.void fireJobAt(String name, Object job, Map<String,Serializable> config, Date date) throws Exception
name
- 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.
IllegalArgumentException
- If the job has not the correct type.
Exception
- If the job can't be scheduled.boolean fireJobAt(String name, Object job, Map<String,Serializable> config, Date date, int times, long period)
name
- 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.
IllegalArgumentException
- If the job has not the correct type.void removeJob(String name) throws NoSuchElementException
name
- The name of the job.
NoSuchElementException
- If the job is not scheduled.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |