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; } }
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; }