Esempio n. 1
0
 /**
  * 设置禁用错过重执行.
  *
  * @param jobName 作业名称
  */
 public void setMisfireDisabled(final String jobName) {
   Optional<CloudJobConfiguration> cloudJobConfig = configService.load(jobName);
   if (cloudJobConfig.isPresent()
       && null != regCenter.getDirectly(ReadyNode.getReadyJobNodePath(jobName))) {
     regCenter.persist(ReadyNode.getReadyJobNodePath(jobName), "1");
   }
 }
Esempio n. 2
0
 /**
  * 从待执行队列中删除相关作业.
  *
  * @param jobNames 待删除的作业名集合
  */
 public void remove(final Collection<String> jobNames) {
   for (String each : jobNames) {
     String readyJobNode = ReadyNode.getReadyJobNodePath(each);
     String timesStr = regCenter.getDirectly(readyJobNode);
     int times = null == timesStr ? 0 : Integer.parseInt(timesStr);
     if (times <= 1) {
       regCenter.remove(readyJobNode);
     } else {
       regCenter.persist(readyJobNode, Integer.toString(times - 1));
     }
   }
 }
Esempio n. 3
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");
   }
 }