Quartz 2.1.5:
public static void getAllJobs(){
try {
Scheduler scheduler = schedulerFactory.getScheduler();
for (String groupName : scheduler.getJobGroupNames()) {
for (JobKey jobKey : scheduler.getJobKeys(GroupMatcher.jobGroupEquals(groupName))) {
String jobName = jobKey.getName();
String jobGroup = jobKey.getGroup();
//get job's trigger
List triggers = (List) scheduler.getTriggersOfJob(jobKey);
Date nextFireTime = triggers.get(0).getNextFireTime();
System.out.println("[jobName] : " + jobName + " [groupName] : "
+ jobGroup + " - " + nextFireTime);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
Quartz 1.8.6
Scheduler scheduler = new StdSchedulerFactory().getScheduler();
//loop all group
for (String groupName : scheduler.getJobGroupNames()) {
//loop all jobs by groupname
for (String jobName : scheduler.getJobNames(groupName)) {
//get job's trigger
Trigger[] triggers = scheduler.getTriggersOfJob(jobName,groupName);
Date nextFireTime = triggers[0].getNextFireTime();
System.out.println("[jobName] : " + jobName + " [groupName] : "
+ groupName + " - " + nextFireTime);
}
}