Package io.jmix.quartz.service
Class QuartzService
java.lang.Object
io.jmix.quartz.service.QuartzService
Serves as proxy from Jmix to the Quartz engine for fetch information about jobs and triggers and update them
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected UnconstrainedDataManagerprotected QuartzJobDetailsFinderprotected Messagesprotected QuartzJobClassFinderprotected QuartzPropertiesprotected RunningJobsCacheprotected org.quartz.Scheduler -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.quartz.CronScheduleBuilderbuildCronSchedule(TriggerModel triggerModel) protected org.quartz.JobDetailbuildJobDetail(JobModel jobModel, @Nullable org.quartz.JobDetail existedJobDetail, List<JobDataParameterModel> jobDataParameterModels) protected org.quartz.SimpleScheduleBuilderbuildSimpleSchedule(TriggerModel triggerModel) protected org.quartz.TriggerbuildTrigger(org.quartz.JobDetail jobDetail, TriggerModel triggerModel) booleancheckJobExists(String jobName, String jobGroup) Delegates to the Quartz engine determination if the given job existsbooleancheckTriggerExists(String triggerName, String triggerGroup) Delegates to the Quartz engine determination if the given trigger existsprotected JobModelcreateJobModel(org.quartz.JobKey jobKey, org.quartz.JobDetail jobDetail, List<org.quartz.JobKey> jobDetailsKeys) protected TriggerModelcreateTriggerModel(org.quartz.Trigger trigger, Date now) voidDelegates to the Quartz engine deleting given jobvoidexecuteNow(String jobName, String jobGroup) Delegates to the Quartz engine triggering given job (executing now)Returns information about all configured quartz jobs with related triggersgetDataParamsOfJob(org.quartz.JobKey jobKey) Returns given job's parametersgetDisplayedClassName(org.quartz.JobDetail jobDetail) Returns names of all known JobDetail groupsReturns names of all known Trigger groupsbooleanisJobRunning(org.quartz.JobKey jobKey) Checks if provided job is runningprotected booleanisJobRunningWithinCurrentScheduler(org.quartz.JobKey jobKey) protected voidlogMissingMisfireInstruction(String misfireInstructionId) voidDelegates to the Quartz engine pausing given job.@Nullable org.quartz.JobDetailresolveJobDetail(org.quartz.JobKey jobKey) Fetches theJobDetailfor the given key.protected JobStateresolveJobState(org.quartz.JobKey jobKey, org.quartz.JobDetail jobDetail, boolean active, boolean hasBlockedTrigger) protected StringresolveMisfireInstructionId(org.quartz.Trigger trigger) voidDelegates to the Quartz engine resuming given job.protected voidsetupSchedule(org.quartz.TriggerBuilder<org.quartz.Trigger> triggerBuilder, TriggerModel triggerModel) protected voidsetupTriggerActivityDates(org.quartz.TriggerBuilder<org.quartz.Trigger> triggerBuilder, TriggerModel triggerModel) voidupdateQuartzJob(JobModel jobModel, List<JobDataParameterModel> jobDataParameterModels, List<TriggerModel> triggerModels, boolean replaceJobIfExists) Updates job in the Quartz engine
-
Field Details
-
scheduler
@Autowired protected org.quartz.Scheduler scheduler -
jobDetailsFinder
-
dataManager
-
messages
-
runningJobsCache
-
quartzProperties
-
quartzJobClassFinder
-
-
Constructor Details
-
QuartzService
public QuartzService()
-
-
Method Details
-
getAllJobs
Returns information about all configured quartz jobs with related triggers -
updateQuartzJob
@Transactional(rollbackForClassName="Exception") public void updateQuartzJob(JobModel jobModel, List<JobDataParameterModel> jobDataParameterModels, List<TriggerModel> triggerModels, boolean replaceJobIfExists) Updates job in the Quartz engine- Parameters:
jobModel- job to editjobDataParameterModels- parameters for jobtriggerModels- triggers for jobreplaceJobIfExists- replace if job with the same name already exists
-
resumeJob
Delegates to the Quartz engine resuming given job. This operation makes sense only for job with paused triggers.- Parameters:
jobName- name of the jobjobGroup- group of the job
-
pauseJob
Delegates to the Quartz engine pausing given job. This operation makes sense only for jobs with active triggers.- Parameters:
jobName- name of the jobjobGroup- group of the job
-
executeNow
Delegates to the Quartz engine triggering given job (executing now)- Parameters:
jobName- name of the jobjobGroup- group of the job
-
deleteJob
Delegates to the Quartz engine deleting given job- Parameters:
jobName- name of the jobjobGroup- group of the job
-
checkJobExists
Delegates to the Quartz engine determination if the given job exists- Parameters:
jobName- name of the jobjobGroup- group of the job- Returns:
- true if job with provided name and group exists, false otherwise
-
checkTriggerExists
Delegates to the Quartz engine determination if the given trigger exists- Parameters:
triggerName- name of the triggertriggerGroup- group of the trigger- Returns:
- true if trigger with provided name and group exists, false otherwise
-
resolveJobDetail
public @Nullable org.quartz.JobDetail resolveJobDetail(org.quartz.JobKey jobKey) Fetches theJobDetailfor the given key. Returns anInvalidJobDetailwhen the job class is missing, ornullwhen the detail cannot be fetched. -
isJobRunning
public boolean isJobRunning(org.quartz.JobKey jobKey) Checks if provided job is running -
getDisplayedClassName
-
getDataParamsOfJob
Returns given job's parameters- Parameters:
jobKey- key of job- Returns:
- parameters of given job
-
getJobGroupNames
Returns names of all known JobDetail groups -
getTriggerGroupNames
Returns names of all known Trigger groups -
createJobModel
protected JobModel createJobModel(org.quartz.JobKey jobKey, org.quartz.JobDetail jobDetail, List<org.quartz.JobKey> jobDetailsKeys) throws org.quartz.SchedulerException - Throws:
org.quartz.SchedulerException
-
createTriggerModel
-
resolveJobState
protected JobState resolveJobState(org.quartz.JobKey jobKey, org.quartz.JobDetail jobDetail, boolean active, boolean hasBlockedTrigger) -
isJobRunningWithinCurrentScheduler
protected boolean isJobRunningWithinCurrentScheduler(org.quartz.JobKey jobKey) -
resolveMisfireInstructionId
-
buildJobDetail
protected org.quartz.JobDetail buildJobDetail(JobModel jobModel, @Nullable org.quartz.JobDetail existedJobDetail, List<JobDataParameterModel> jobDataParameterModels) throws ClassNotFoundException - Throws:
ClassNotFoundException
-
buildTrigger
protected org.quartz.Trigger buildTrigger(org.quartz.JobDetail jobDetail, TriggerModel triggerModel) -
setupSchedule
protected void setupSchedule(org.quartz.TriggerBuilder<org.quartz.Trigger> triggerBuilder, TriggerModel triggerModel) -
setupTriggerActivityDates
protected void setupTriggerActivityDates(org.quartz.TriggerBuilder<org.quartz.Trigger> triggerBuilder, TriggerModel triggerModel) -
buildCronSchedule
-
buildSimpleSchedule
-
logMissingMisfireInstruction
-