@Override
    public Boolean apply(TaskWrapper input) {
      if (input == null) return true;
      boolean canFinish = input.getTaskRunnerCallable().canFinishForPriority();
      if (firstCannotFinish == null && !canFinish) {
        firstCannotFinish = input;
        return true;
      }
      if (firstCannotFinish != null && canFinish) {
        firstProblematic = input;
        return false;
      }
      return true;
    }
Assumes the epic lock is already taken.
llap-server/src/java/org/apache/hadoop/hive/llap/daemon/impl/TaskExecutorService.java