예제 #1
0
 public void removeAllJobs() throws SchedulerException {
   for (String groupName : quartzScheduler.getJobGroupNames()) {
     for (JobKey jobKey : quartzScheduler.getJobKeys(GroupMatcher.jobGroupEquals(groupName))) {
       quartzScheduler.deleteJob(jobKey);
     }
   }
 }
예제 #2
0
 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());
 }
예제 #3
0
 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;
 }
예제 #4
0
  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;
  }
예제 #5
0
 public void resumeJob(JobKey jobKey) throws SchedulerException {
   quartzScheduler.resumeJob(jobKey);
 }
예제 #6
0
 public void pauseJob(JobKey jobKey) throws SchedulerException {
   quartzScheduler.pauseJob(jobKey);
 }
예제 #7
0
 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));
 }
예제 #8
0
 /**
  * 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));
 }
예제 #9
0
 public void removeJob(JobKey jobKey) throws SchedulerException {
   quartzScheduler.deleteJob(jobKey);
 }