Пример #1
0
 public boolean handlerJob(ServerJob serverJob) {
   if (serverJob == null) return false;
   serverJob.setServerIp(IpUtil.getLocalIP());
   logger.error("handlerJob >>> getExecuteType :::" + serverJob.getExecuteType());
   switch (serverJob.getExecuteType()) {
     case ADD:
       return addJob(serverJob);
     case DELETE:
       return deleteJob(serverJob);
     case UPDATE:
       return updateJob(serverJob);
     default:
       return false;
   }
 }
Пример #2
0
 private boolean addJob(ServerJob serverJob) {
   logger.error("addJob -> MongoDBUtil: insertOrUpdate  >>>");
   try {
     if (!scheduler.add(serverJob)) return false;
     return MongoDBUtil.INSTANCE.insertOrUpdate(
         BuildMongoDBData.getInsertJobBasicDBObject(serverJob), DBTableInfo.TBL_CLOVER_JOB);
   } catch (Exception e) {
     logger.error("ModuleSchedulerServer-->>addJob(" + serverJob.toString() + ") error", e);
     String execMethod = "ModuleSchedulerServer-->>addJob(" + serverJob.toString() + ")";
     String execResult =
         "ModuleSchedulerServer-->>addJob(" + serverJob.toString() + ") error ," + e.getMessage();
     MongoDBUtil.INSTANCE.insert(
         BuildMongoDBData.getInsertLogBasicDBObject(
             serverJob.getJobDetail().getKey().toString(), execMethod, execResult),
         DBTableInfo.TBL_CLOVER_LOG);
     return false;
   }
 }
Пример #3
0
 private BasicDBObject getDeleteRemoteJobBasicDBObject(ServerJob deleteJob) {
   BasicDBObject condition = new BasicDBObject();
   condition.put(DBTableInfo.COL_JOB_KEY, deleteJob.getJobDetail().getKey().toString());
   condition.put(DBTableInfo.COL_JOB_TYPE, CommonConstants.JOB_TYPE_REMOTE);
   return condition;
 }