Package com.quartz.monitor.object

Examples of com.quartz.monitor.object.Trigger


         log.info("-------"+jobName+" trigger size:"+list.size());
           triggers = new ArrayList<Trigger>();
           for (int i = 0; i < list.size(); i++)
           {
              CompositeDataSupport compositeDataSupport = (CompositeDataSupport) list.get(i);
              Trigger trigger = new Trigger();
              trigger.setCalendarName((String) JMXUtil.convertToType(compositeDataSupport, "calendarName"));
              log.info("-------"+jobName+" trigger's calendar name:"+trigger.getCalendarName());
              trigger.setDescription((String) JMXUtil.convertToType(compositeDataSupport, "description"));
              trigger.setEndTime((Date) JMXUtil.convertToType(compositeDataSupport, "endTime"));
              trigger.setFinalFireTime((Date) JMXUtil.convertToType(compositeDataSupport, "finalFireTime"));
              trigger.setFireInstanceId((String) JMXUtil.convertToType(compositeDataSupport, "fireInstanceId"));
              trigger.setGroup((String) JMXUtil.convertToType(compositeDataSupport, "group"));
              trigger.setJobGroup((String) JMXUtil.convertToType(compositeDataSupport, "jobGroup"));
              trigger.setJobName((String) JMXUtil.convertToType(compositeDataSupport, "jobName"));
              log.info("-------"+jobName+" trigger's job name:"+trigger.getJobName());
              trigger.setMisfireInstruction(((Integer) JMXUtil.convertToType(compositeDataSupport, "misfireInstruction")).intValue());
              trigger.setName((String) JMXUtil.convertToType(compositeDataSupport, "name"));
              log.info("-------"+jobName+" trigger's  name:"+trigger.getName());
              trigger.setNextFireTime((Date) JMXUtil.convertToType(compositeDataSupport, "nextFireTime"));
              log.info("-------"+jobName+" trigger's  nextFireTime:"+trigger.getNextFireTime());
              trigger.setPreviousFireTime((Date) JMXUtil.convertToType(compositeDataSupport, "previousFireTime"));
              trigger.setPriority(((Integer) JMXUtil.convertToType(compositeDataSupport, "priority")).intValue());
              trigger.setStartTime((Date) JMXUtil.convertToType(compositeDataSupport, "startTime"));

             
              try
              {
                 JMXInput stateJmxInput = new JMXInput(quartzInstance, new String[]{String.class.getName(), String.class.getName()}, "getTriggerState", new Object[]{trigger.getName(), trigger.getGroup()}, scheduler.getObjectName());
                 String state = (String) JMXUtil.callJMXOperation(stateJmxInput);
                 trigger.setSTriggerState(state);
              }
              catch (Throwable tt)
              {
                 trigger.setSTriggerState(Trigger.STATE_GET_ERROR);
              }

              //删除group为"now"的trigger
              if(trigger.getGroup().equals("now")){
                deleteTrigger(quartzInstance, scheduler, trigger);
              }else{
                 triggers.add(trigger);
              }
           }
View Full Code Here


  public String delete() throws Exception {
   
    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("");
    JsonUtil.toJson(new Gson().toJson(result));
View Full Code Here

      Date theNext = null;
      if (triggers != null && triggers.size() > 0)
      {
         for (int i = 0; i < triggers.size(); i++)
         {
            Trigger trigger = triggers.get(i);
            if (trigger.getNextFireTime() == null)
            {
               continue;
            }else{
              theNext = trigger.getNextFireTime();
            }
            if (theNext != null && trigger.getNextFireTime().before(theNext))
            {
               theNext = trigger.getNextFireTime();
            }
         }
      }
      return theNext;
   }
View Full Code Here

TOP

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

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.