Class SchedulerService
java.lang.Object
com.eurodyn.qlack.fuse.scheduler.service.SchedulerService
Provides scheduler administration functionality
- Author:
- European Dynamics SA.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears all scheduled jobsboolean
Deletes a scheduled jobboolean
deleteJobs
(List<String> jobNames) Deletes multiple jobsFinds all jobs that are currently executedCollects information about all existing jobs.static <J extends org.quartz.Job>
StringgetJobName
(Class<J> jobClass) A helper method to define the name of a job based on the class implementing the job.<J extends org.quartz.Job>
DategetNextFireForJob
(Class<J> jobClass) Finds the next execution of a job<J extends org.quartz.Job>
DategetPreviousFireForJob
(Class<J> jobClass) Finds the previous execution time of a jobRetrieves the id of the of the Quartz scheduler instance used in the applicationRetrieves the name of the Quartz scheduler instance used in the applicationstatic <J extends org.quartz.Job>
StringgetTriggerName
(Class<J> jobClass) A helper method to define the name of a trigger based on the class implementing the job.boolean
Checks if the Quartz Scheduler instance is in standby mode<J extends org.quartz.Job>
booleanisJobExisting
(Class<J> jobClass) Checks if a job existsboolean
Checks if the Quartz Scheduler instance has been terminatedboolean
Checks if the Quartz Scheduler instance has started<J extends org.quartz.Job>
booleanisTriggerExisting
(Class<J> jobClass) Checks if a trigger existsvoid
Pauses all triggers<J extends org.quartz.Job>
voidPauses all future executions of a job<J extends org.quartz.Job>
voidregisterJob
(Class<J> jobClass) Registers a job to the scheduler's list of jobs.<J extends org.quartz.Job>
voidregisterJob
(Class<J> jobClass, Map<String, Object> jobData) Registers a job to the scheduler's list of jobs.<J extends org.quartz.Job>
voidrescheduleJob
(Class<J> jobClass, String cronExpression) Reschedules a jobvoid
Resumes all triggers<J extends org.quartz.Job>
voidscheduleJob
(Class<J> jobClass, String cronExpression) Schedules a job for execution<J extends org.quartz.Job>
voidSchedules a job for executionvoid
shutdown()
Terminates the Quartz scheduler instancevoid
standby()
Pauses the Quartz scheduler instancevoid
start()
Starts the Quartz scheduler instance<J extends org.quartz.Job>
voidtriggerJob
(Class<J> jobClass) Triggers the execution of a job<J extends org.quartz.Job>
voidtriggerJob
(Class<J> jobClass, Map<String, Object> jobData) Triggers the execution of a job
-
Constructor Details
-
SchedulerService
@Autowired public SchedulerService(org.quartz.Scheduler scheduler)
-
-
Method Details
-
getJobName
A helper method to define the name of a job based on the class implementing the job.- Type Parameters:
J
- the Job Object- Parameters:
jobClass
- the class implementing the job- Returns:
- the name of the job
-
getTriggerName
A helper method to define the name of a trigger based on the class implementing the job.- Type Parameters:
J
- the Job Object- Parameters:
jobClass
- the class implementing the job.- Returns:
- returns the name of the trigger
-
getSchedulerName
Retrieves the name of the Quartz scheduler instance used in the application- Returns:
- the name of the Quartz scheduler instance
-
getSchedulerInstanceID
Retrieves the id of the of the Quartz scheduler instance used in the application- Returns:
- the id of the Quartz scheduler instance
-
start
public void start()Starts the Quartz scheduler instance -
shutdown
public void shutdown()Terminates the Quartz scheduler instance -
standby
public void standby()Pauses the Quartz scheduler instance -
isStarted
public boolean isStarted()Checks if the Quartz Scheduler instance has started- Returns:
- true if started, false otherwise
-
isShutdown
public boolean isShutdown()Checks if the Quartz Scheduler instance has been terminated- Returns:
- true if terminated, false otherwise
-
isInStandbyMode
public boolean isInStandbyMode()Checks if the Quartz Scheduler instance is in standby mode- Returns:
- true if paused, false otherwise
-
registerJob
Registers a job to the scheduler's list of jobs. A registered job, should be scheduled manually.- Type Parameters:
J
- the Job Object- Parameters:
jobClass
- a class implementing the Job interface
-
registerJob
Registers a job to the scheduler's list of jobs. A registered job, should be scheduled manually.- Type Parameters:
J
- the Job Object to access on execution- Parameters:
jobClass
- a class implementing the Job interfacejobData
- a map containing any number of serializable objects, that the job will be able
-
scheduleJob
Schedules a job for execution- Type Parameters:
J
- the Job Object- Parameters:
jobClass
- a class implementing the job interfacecronExpression
- a cron expression defining the execution interval of the job
-
scheduleJob
public <J extends org.quartz.Job> void scheduleJob(Class<J> jobClass, String cronExpression, Map<String, Object> jobData) Schedules a job for execution- Type Parameters:
J
- the Job Object- Parameters:
jobClass
- a class implementing the job interfacecronExpression
- a cron expression defining the execution interval of the jobjobData
- a map containing any number of serializable objects, that the job will be able to access on execution
-
rescheduleJob
Reschedules a job- Type Parameters:
J
- the Job Object- Parameters:
jobClass
- a class implementing the job interfacecronExpression
- a cron expression defining the execution interval of the job
-
deleteJob
Deletes a scheduled job- Parameters:
jobName
- The class name of the job to delete- Returns:
- true if job has been deleted, false otherwise
-
deleteJobs
Deletes multiple jobs- Parameters:
jobNames
- a list containing the job names to delete- Returns:
- true if all jobs have been deleted, false otherwise
-
triggerJob
Triggers the execution of a job- Type Parameters:
J
- the Job Object- Parameters:
jobClass
- a class implementing the Job interface
-
triggerJob
Triggers the execution of a job- Type Parameters:
J
- the Job Object- Parameters:
jobClass
- a class implementing the Job interfacejobData
- a map containing any number of serializable objects, that the job will be able to access on execution
-
pauseJob
Pauses all future executions of a job- Type Parameters:
J
- the Job Object- Parameters:
jobClass
- a class implementing the Job interface
-
pauseAllTriggers
public void pauseAllTriggers()Pauses all triggers -
resumeAllTriggers
public void resumeAllTriggers()Resumes all triggers -
clear
public void clear()Clears all scheduled jobs -
getNextFireForJob
Finds the next execution of a job- Type Parameters:
J
- the Job Object- Parameters:
jobClass
- a class implementing the Job interface- Returns:
- the job's next execution date
-
getPreviousFireForJob
Finds the previous execution time of a job- Type Parameters:
J
- the Job Object- Parameters:
jobClass
- a class implementing the Job interface- Returns:
- the job's previous execution date
-
isJobExisting
Checks if a job exists- Type Parameters:
J
- the Job Object- Parameters:
jobClass
- a class implementing the Job interface- Returns:
- true if exists, false otherwise
-
isTriggerExisting
Checks if a trigger exists- Type Parameters:
J
- the Job Object- Parameters:
jobClass
- a class implementing the Job interface- Returns:
- true if exists, false otherwise
-
getCurrentlyExecutingJobsNames
Finds all jobs that are currently executed- Returns:
- a list with the names of the jobs
-
getJobInfo
Collects information about all existing jobs. The information collected is the job's name, group and next execution date- Returns:
- a list of JobDTO containing the information about each job
-