Exemple #1
0
  @Override
  public boolean handle(JobOperationBean task) {
    try {
      if (task.getOperation() != JobOperationEnum.CREATE
          && task.getOperation() != JobOperationEnum.UPDATE) return true;

      if (JobOperationEnum.UPDATE == task.getOperation()) {
        List<String> oldJids = jobDAO.selectOldJid(task.getJid());
        if (oldJids == null || oldJids.size() < 1) { // 表示这个职位还没有在job_table中
          translate.translateJob(task.getJid()); // 这个职位有可能被添加到job_table或者添加到了job_third_part中
          oldJids =
              jobDAO.selectOldJid(task.getJid()); // 如果这个职位被添加到了job_table中,那么需要将它从job_third_part中删除
          if (oldJids != null && oldJids.size() > 0) {
            jobThirdPartDAO.deleteJobThirdPartInfo(task.getJid());
          }

        } else {
          return true;
        }
        return true;
      }

      String[] jids = task.getJid().split(",");
      for (String jid : jids) {
        translate.translateJob(jid);
      }
    } catch (Exception e) {
      LoggerInformation.LoggerErr(logger, "job worker error ", e);

      return true;
    }
    return true;
  }
  private void initMethodMapping() {
    Method[] methods = classInterface.getMethods();
    for (Method method : methods) {
      if (!OBJECT_METHODS.contains(method.getName())) {
        Method objectMethod = getMethodByName(classObject.getClass(), method.getName());
        if (objectMethod == null) {
          LoggerInformation.LoggerErr(
              "interface no method map with object " + method.getName(), new Exception());
        }

        methodMapping.put(method.getName().toLowerCase(), new MethodMeta(method, objectMethod));
      }
    }
  }