Interface IScheduler
- All Known Implementing Classes:
DefaultScheduler
The IScheduler exposes the main methods for handling Jobs inside Blueriq application. This mantains a registry of Jobs and Triggers. Once a Job is registered, it is responsible to fire it's execution when the scheduling time arrives.
This Blueriq Scheduler interface is a wrapper upon the Quartz Scheduler which exposes the required methods for scheduling/unscheduling/starting/shutting down the quartz scheduler. The default implementation can be found in the DefaultScheduler class.
After a Scheduler has been created, it is in "stand-by" mode, and must have its startScheduler() method called before it will fire any Jobs. When the Scheduler is not needed it's execution can be fired down with the shutdownScheduler() method.
SchedulerJobConfiguration
objects are created at runtime, by defining the necessary information (task id, job
object, trigger parameters) to schedule a job instance wia the scheduleJob(SchedulerJobConfiguration) method.
Jobs can be unscheduled when needed with the unscheduleJob(SchedulerJobConfiguration) method.
- Since:
- 10.2
- Author:
- TimeaP
-
Method Summary
Modifier and TypeMethodDescriptionThis method creates the object representing the job parameters.This method returns a schedule builder which can be used for creatingISchedule
objects.void
reschedule
(IJobId jobId, ISchedule schedule) This method reschedules a job.schedule
(Class<? extends IJob> jobClass, IJobParameters params, ISchedule schedule) This method schedules a job.void
scheduleJob
(SchedulerJobConfiguration schedulerJobConfiguration) Schedule a given job defined inSchedulerJobConfiguration
with the related set of triggers fromSchedulerJobConfiguration
associated with it.void
This method stops the execution of all the jobs registered to the scheduler.void
This method starts the scheduler which assumes that the execution of its jobs can begin.void
unschedule
(IJobId jobId) This method unschedules a previously scheduled jobvoid
unscheduleJob
(SchedulerJobConfiguration schedulerJobConfiguration) This method stops the execution of a certain job by unregistering its trigger(s) defined inSchedulerJobConfiguration
.void
This method updates the job data map with the new values sent in the parameter.
-
Method Details
-
scheduleJob
Schedule a given job defined inSchedulerJobConfiguration
with the related set of triggers fromSchedulerJobConfiguration
associated with it.- Parameters:
schedulerJobConfiguration
- the configuration
-
startScheduler
void startScheduler()This method starts the scheduler which assumes that the execution of its jobs can begin. Until this point, the scheduler will be in 'stand-by' mode. -
shutdownScheduler
void shutdownScheduler()This method stops the execution of all the jobs registered to the scheduler. -
unscheduleJob
This method stops the execution of a certain job by unregistering its trigger(s) defined inSchedulerJobConfiguration
. If the job has no other triggers, the job itself will be deleted as well.- Parameters:
schedulerJobConfiguration
- the configuration
-
schedule
This method schedules a job.- Parameters:
jobClass
- the class of the jobparams
- the parameters of the jobschedule
- the schedule of the job- Returns:
- the id of the job
- Throws:
SchedulerException
- if the job can not be scheduled
-
unschedule
This method unschedules a previously scheduled job- Parameters:
jobId
- the ID of the job
-
reschedule
This method reschedules a job. The old schedule is replaced by the new schedule- Parameters:
jobId
- the ID of the jobschedule
- the new schedule of the job
-
getScheduleBuilder
IScheduleBuilder getScheduleBuilder()This method returns a schedule builder which can be used for creatingISchedule
objects.- Returns:
- the created scheduleBuilder
-
createJobParameters
IJobParameters createJobParameters()This method creates the object representing the job parameters.- Returns:
- a new job parameters object
-
updateJobData
This method updates the job data map with the new values sent in the parameter.- Parameters:
config
- Job configuration with the new values.
-