public void removeAllJobs() throws SchedulerException { for (String groupName : quartzScheduler.getJobGroupNames()) { for (JobKey jobKey : quartzScheduler.getJobKeys(GroupMatcher.jobGroupEquals(groupName))) { quartzScheduler.deleteJob(jobKey); } } }
public RunTimeJobDetail scheduleJob(JobDetail jobDetail, Trigger trigger) throws SchedulerException, JobAlreadyExistsException { if (quartzScheduler.checkExists(jobDetail.getKey())) throw new JobAlreadyExistsException(jobDetail.getKey().getName() + " already exists"); quartzScheduler.scheduleJob(jobDetail, trigger); return getJobDetails(jobDetail.getKey().getGroup(), jobDetail.getKey().getName()); }
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; }
public void resumeJob(JobKey jobKey) throws SchedulerException { quartzScheduler.resumeJob(jobKey); }
public void pauseJob(JobKey jobKey) throws SchedulerException { quartzScheduler.pauseJob(jobKey); }
public RunTimeJobDetail getJobDetails(String group, String name) throws SchedulerException { JobKey jobKey = new JobKey(name, group); return new RunTimeJobDetail() .setJobDetail(quartzScheduler.getJobDetail(jobKey)) .setTriggers(quartzScheduler.getTriggersOfJob(jobKey)); }
/** * Search Trigger * * @param group * @param name * @return * @throws SchedulerException */ public Trigger getTrigger(String group, String name) throws SchedulerException { return quartzScheduler.getTrigger(new TriggerKey(name, group)); }
public void removeJob(JobKey jobKey) throws SchedulerException { quartzScheduler.deleteJob(jobKey); }