/**
   * 从队列中删除已运行的作业.
   *
   * @param taskContexts 任务上下文集合
   */
  public void removeLaunchTasksFromQueue(final List<TaskContext> taskContexts) {
    List<TaskContext> failoverTaskContexts = new ArrayList<>(taskContexts.size());
    Collection<String> misfiredJobNames = new HashSet<>(taskContexts.size(), 1);
    Collection<String> readyJobNames = new HashSet<>(taskContexts.size(), 1);
    for (TaskContext each : taskContexts) {
      switch (each.getType()) {
        case FAILOVER:
          failoverTaskContexts.add(each);
          break;
        case MISFIRED:
          misfiredJobNames.add(each.getMetaInfo().getJobName());
          break;
        case READY:
          readyJobNames.add(each.getMetaInfo().getJobName());
          break;
        default:
          break;
      }
    }
    failoverService.remove(
        Lists.transform(
            failoverTaskContexts,
            new Function<TaskContext, TaskContext.MetaInfo>() {

              @Override
              public TaskContext.MetaInfo apply(final TaskContext input) {
                return input.getMetaInfo();
              }
            }));
    misfiredService.remove(misfiredJobNames);
    readyService.remove(readyJobNames);
  }
 /**
  * 记录失效转移队列.
  *
  * @param taskContext 任务上下文
  */
 public void recordFailoverTask(final TaskContext taskContext) {
   TaskContext.MetaInfo metaInfo = taskContext.getMetaInfo();
   Optional<CloudJobConfiguration> jobConfig = configService.load(metaInfo.getJobName());
   if (jobConfig.isPresent() && jobConfig.get().getTypeConfig().getCoreConfig().isFailover()) {
     failoverService.add(taskContext);
   }
   runningService.remove(metaInfo);
 }