Package com.quartz.monitor.object

Examples of com.quartz.monitor.object.Job


    QuartzInstance instance = Tools.getQuartzInstance();
    List<Scheduler> schedulers = instance.getSchedulerList();
    log.info(" schedulers list size:"+schedulers.size());

    Job job = JobContainer.getJobById(jobId);
    Scheduler scheduler = instance.getSchedulerByName(job.getSchedulerName());

    List<Trigger> temp = instance.getJmxAdapter().getTriggersForJob(instance, scheduler,job.getJobName(), job.getGroup());
    if(temp == null || temp.size() == 0){
      return "list";
    }
    for (Trigger trigger : temp) {
      String id = Tools.generateUUID();
      trigger.setUuid(id);
      trigger.setJobId(jobId);
      TriggerContainer.addTrigger(id, trigger);
      triggerList.add(trigger);
    }
    log.info("job[" + job.getJobName() + "]'s trigger size:" + triggerList.size());
    return "list";
  }
View Full Code Here


      triggerMap.put("triggerClass", "org.quartz.impl.triggers.SimpleTriggerImpl");
    }else{
      triggerMap.put("cronExpression", triggerInput.getCron());
      triggerMap.put("triggerClass", "org.quartz.impl.triggers.CronTriggerImpl");
    }
    Job job = JobContainer.getJobById(jobId);
    triggerMap.put("jobName", job.getJobName());
    triggerMap.put("jobGroup", job.getGroup());
   
    instance.getJmxAdapter().addTriggerForJob(instance, instance.getSchedulerByName(job.getSchedulerName()), job,triggerMap);
   
    log.info("add trigger for job:"+job.getJobName());
   
   
    Result result = new Result();
    result.setMessage("添加成功");
    result.setNavTabId("triggerList");
View Full Code Here

    QuartzInstance instance = Tools.getQuartzInstance();
   
    Trigger trigger = TriggerContainer.getTriggerById(uuid);
    TriggerContainer.removeTriggerById(uuid);

    Job job = JobContainer.getJobById(trigger.getJobId());
    instance.getJmxAdapter().deleteTrigger(instance, instance.getSchedulerByName(job.getSchedulerName()), trigger);
    log.info("delete job["+trigger.getJobName()+"]'s trigger!");
    Result result = new Result();
    result.setMessage("删除成功");
    result.setNavTabId("triggerList");
    result.setCallbackType("");
View Full Code Here

 
 
  public String start() throws Exception {

    QuartzInstance instance = Tools.getQuartzInstance();
    Job job = JobContainer.getJobById(uuid);
    instance.getJmxAdapter().startJobNow(instance, instance.getSchedulerByName(job.getSchedulerName()), job);
   
    Result result = new Result();
    result.setStatusCode("200");
    result.setMessage("执行成功");
    result.setCallbackType("");
View Full Code Here

  public String delete() throws Exception {

   
    QuartzInstance instance = Tools.getQuartzInstance();
   
    Job job = JobContainer.getJobById(uuid);
    JobContainer.removeJobById(uuid);
    log.info("delete a quartz job!");
    instance.getJmxAdapter().deleteJob(instance, instance.getSchedulerByName(job.getSchedulerName()), job);
    Result result = new Result();
    result.setMessage("删除成功");
    JsonUtil.toJson(new Gson().toJson(result));
    return null;
  }
View Full Code Here

 
  public String pause() throws Exception {

    QuartzInstance instance = Tools.getQuartzInstance();

    Job job = JobContainer.getJobById(uuid);
    log.info("pause a quartz job!");
    instance.getJmxAdapter().pauseJob(instance, instance.getSchedulerByName(job.getSchedulerName()), job);
    Result result = new Result();
    result.setMessage("Job已暂停");
    result.setCallbackType("");
    JsonUtil.toJson(new Gson().toJson(result));
    return null;
View Full Code Here

 
  public String resume() throws Exception {

    QuartzInstance instance = Tools.getQuartzInstance();

    Job job = JobContainer.getJobById(uuid);
    log.info("resume a quartz job!");
    instance.getJmxAdapter().resumeJob(instance, instance.getSchedulerByName(job.getSchedulerName()), job);
   
    Result result = new Result();
    result.setMessage("Job已恢复");
    result.setCallbackType("");
    JsonUtil.toJson(new Gson().toJson(result));
View Full Code Here

        Object object = (Object) it.next();
        if (!(object instanceof CompositeDataSupport)) {
          continue;
        }
        CompositeDataSupport compositeDataSupport = (CompositeDataSupport) object;
        Job job = new Job();
        job.setSchedulerName(scheduler.getName());
        job.setQuartzInstanceId(scheduler.getQuartzInstanceUUID());
        job.setSchedulerInstanceId(scheduler.getInstanceId());
        job.setJobName((String) JMXUtil.convertToType(compositeDataSupport, "name"));
        log.info("job name:"+job.getJobName());
        job.setDescription((String) JMXUtil.convertToType(compositeDataSupport,"description"));
        job.setDurability(((Boolean) JMXUtil.convertToType(compositeDataSupport,"durability")).booleanValue());
        job.setShouldRecover(((Boolean) JMXUtil.convertToType(compositeDataSupport,"shouldRecover")).booleanValue());
        job.setGroup((String) JMXUtil.convertToType(compositeDataSupport, "group"));
        job.setJobClass((String) JMXUtil.convertToType(compositeDataSupport, "jobClass"));

        // get Next Fire Time for job
        List<Trigger> triggers = this.getTriggersForJob(quartzInstance, scheduler,
            job.getJobName(), job.getGroup());
       
        if(triggers == null || triggers.size() == 0){
          job.setState("NONE");
        }else{
          job.setState(getTriggerState(quartzInstance,scheduler,triggers.get(0)));
        }
       
        log.info("job state:"+job.getState());
        try {
          if (triggers != null && triggers.size() > 0) {
            Date nextFireTime = QuartzUtil.getNextFireTimeForJob(triggers);
            job.setNextFireTime(nextFireTime);
            job.setNumTriggers(triggers.size());
          }
        } catch (Throwable t) {
          t.printStackTrace();
        }
View Full Code Here

TOP

Related Classes of com.quartz.monitor.object.Job

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.