Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if a job is running in Quartz Framework

Tags:

I want to use Quartz Framework in my application. There are two jobs in the scheduler. Now I want to check if job1 is running. How can I check? I have tried to Google it but failed to find the solution.

I am following the first of example from Quartz distribution.

like image 416
Anand Soni Avatar asked Dec 19 '11 11:12

Anand Soni


People also ask

How do I Unschedule a quartz job?

We can unschedule a Job by calling the unschedule() method of the Scheduler class and passing the TriggerKey . If the related job does not have any other triggers, and the job is not durable, then the job will also be deleted.

Is Non Concurrent quartz?

@DisallowConcurrentExecution is an annotation that can be added to the Job class that tells Quartz not to execute multiple instances of a given job definition (that refers to the given job class) concurrently.


2 Answers

You can use scheduler.getCurrentlyExecutingJobs() to get a list of all jobs which are currently running.

like image 132
dogbane Avatar answered Sep 21 '22 08:09

dogbane


Please note scheduler.getCurrentlyExecutingJobs() just check for the current scheduler instance,not the whole cluster。

like image 28
arganzheng Avatar answered Sep 24 '22 08:09

arganzheng