public void removeAllJobs() throws SchedulerException { for (String groupName : quartzScheduler.getJobGroupNames()) { for (JobKey jobKey : quartzScheduler.getJobKeys(GroupMatcher.jobGroupEquals(groupName))) { quartzScheduler.deleteJob(jobKey); } } }
public List<RunTimeJobDetail> listAllJobs() throws SchedulerException { List<RunTimeJobDetail> jobs = new ArrayList<RunTimeJobDetail>(); for (String groupName : quartzScheduler.getJobGroupNames()) { for (JobKey jobKey : quartzScheduler.getJobKeys(GroupMatcher.jobGroupEquals(groupName))) { jobs.add(getJobDetails(groupName, jobKey.getName())); } } return jobs; }
public List<RunTimeJobDetail> searchJobs(String groupExp, String nameExp) throws SchedulerException { Pattern groupPattern = Pattern.compile(groupExp); Pattern namePattern = Pattern.compile(nameExp); List<RunTimeJobDetail> jobs = new ArrayList<RunTimeJobDetail>(); for (String groupName : quartzScheduler.getJobGroupNames()) { if (groupPattern.matcher(groupName).matches()) { for (JobKey jobKey : quartzScheduler.getJobKeys(GroupMatcher.jobGroupEquals(groupName))) { if (namePattern.matcher(jobKey.getName()).matches()) { jobs.add(getJobDetails(groupName, jobKey.getName())); } } } } return jobs; }