Failed to get job list in quartz scheduler

I am trying to get all jobs registered in the Quartz scheduler for a specific group. here is my code snippet

CustomSchdularFactory.getSchedulerInstance().getJobKeys(groupEquals(group)); 

here group is a string variable containing the name of the group whose related jobs I want to get. when using the above code I get the following error

 The method getJobKeys(GroupMatcher<JobKey>) in the type Scheduler is not applicable for the arguments (GroupMatcher<Key<Key<T>>>) 

I am not sure why this error occurs when I took the link from Quartz official docs.

Listjobs

+4
source share
2 answers

Use jobGroupEquals instead of groupEquals

 CustomSchdularFactory.getSchedulerInstance().getJobKeys(jobGroupEquals(group)); 

and it will work for you.

+6
source

Use it

 Scheduler sched = new StdSchedulerFactory().getScheduler(); for(String group: sched.getJobGroupNames()) { for(JobKey jobKey : sched.getJobKeys(GroupMatcher.jobGroupEquals(group))) { ... } } 
+2
source

All Articles