예제 #1
0
 /**
  * 将常驻作业放入待执行队列.
  *
  * @param jobName 作业名称
  */
 public void addDaemon(final String jobName) {
   if (regCenter.getNumChildren(ReadyNode.ROOT)
       > env.getFrameworkConfiguration().getJobStateQueueSize()) {
     log.warn(
         "Cannot add daemon job, caused by read state queue size is larger than {}.",
         env.getFrameworkConfiguration().getJobStateQueueSize());
     return;
   }
   Optional<CloudJobConfiguration> cloudJobConfig = configService.load(jobName);
   if (!cloudJobConfig.isPresent()
       || JobExecutionType.DAEMON != cloudJobConfig.get().getJobExecutionType()) {
     return;
   }
   regCenter.persist(ReadyNode.getReadyJobNodePath(jobName), "1");
 }
예제 #2
0
 /**
  * 将瞬时作业放入待执行队列.
  *
  * @param jobName 作业名称
  */
 public void addTransient(final String jobName) {
   if (regCenter.getNumChildren(ReadyNode.ROOT)
       > env.getFrameworkConfiguration().getJobStateQueueSize()) {
     log.warn(
         "Cannot add transient job, caused by read state queue size is larger than {}.",
         env.getFrameworkConfiguration().getJobStateQueueSize());
     return;
   }
   Optional<CloudJobConfiguration> cloudJobConfig = configService.load(jobName);
   if (!cloudJobConfig.isPresent()
       || JobExecutionType.TRANSIENT != cloudJobConfig.get().getJobExecutionType()) {
     return;
   }
   String readyJobNode = ReadyNode.getReadyJobNodePath(jobName);
   String times = regCenter.getDirectly(readyJobNode);
   if (cloudJobConfig.get().getTypeConfig().getCoreConfig().isMisfire()) {
     regCenter.persist(
         readyJobNode, Integer.toString(null == times ? 1 : Integer.parseInt(times) + 1));
   } else {
     regCenter.persist(ReadyNode.getReadyJobNodePath(jobName), "1");
   }
 }