Example #1
0
  public void run() {
    setExecuted();

    Calendar date = Calendar.getInstance(Locale.CHINA);
    int hour = date.get(Calendar.HOUR_OF_DAY);
    if (hour >= 6) {
      return;
    }
    addLog();
    if (judge()) {
      for (String str_ : devices) {
        ExecuteLog el = logMap.get(str_);
        el.setStatus("正在执行");
        executeLogDao.update(el);
      }
      execute();
      /*endLoadBalance.start();
      try {
      	endLoadBalance.join();
      } catch (InterruptedException e) {
      	logger.error("",e);
      }*/
    } else {
      for (String str_ : devices) {
        ExecuteLog el = logMap.get(str_);
        executeLogDao.appendLog(el, "当前任务组中有设备正在执行命令,退出.");
      }
      logger.warn("当前任务组中有设备正在执行命令,退出.");
    }
    loadBalance.setFinish(true);
    setCompleteLog();
  }
Example #2
0
 private void setCompleteLog() {
   for (String str : devices) {
     ExecuteLog el = logMap.get(str);
     el.setStatus("完成");
     el.setEndTime(new Date());
     executeLogDao.update(el);
   }
 }
Example #3
0
 private void addLog() {
   for (String str : devices) {
     ExecuteLog el = new ExecuteLog();
     el.setStartTime(new Date());
     el.setId(UUID.randomUUID().toString());
     el.setGgsnName(str);
     el.setOperateResult("start");
     el.setOperateType(taskType);
     el.setStatus("待验证");
     el.setTaskId(task_id);
     logMap.put(str, el);
     executeLogDao.insertExecuteLog(el);
   }
 }