/*
(non-Javadoc)

@see com.ibm.websphere.concurrent.persistent.mbean.PersistentExecutorMBean#findTaskIds(long, java.lang.String, boolean, java.lang.Long, java.lang.Integer)
552125
@Override
    public Long[] findTaskIds(long partition, String state, boolean inState, Long minId, Integer maxResults) throws Exception {

        try {
            TaskState ts = TaskState.valueOf(state);
            return _pe.findTaskIds(partition, ts, inState, minId, maxResults);
        } catch (Exception e) {
            throw buildAndLogException(e);
        }
    }
916815
@Override
    public Iterable<T> findAll(Iterable<I> ids) {
        List<T> results = new ArrayList<>();
        for (I id : ids) {
            T t = findOne(id);
            if (t != null) {
                results.add(t);
            }
        }
        return results;
    }
1046040
@Service
    public Map<String, Integer> getTaskQueueSizes(List<String> taskTypes) {
        return executionService.getTaskQueueSizes(taskTypes);
    }
1210126
public static List<String> findIndexNames(final String root) throws IOException, URISyntaxException {
        if (root == null) {
            return findIndexNames();
        }

        logger.debug("Looking for indices in classpath under [{}].", root);

        final List<String> indexNames = new ArrayList<>();
        final Set<String> keys = new HashSet<>();
        String[] resources = ResourceList.getResources(root + "/"); // "es/" or "a/b/c/"
        for (String resource : resources) {
            if (!resource.isEmpty()) {
                logger.trace(" - resource [{}].", resource);
                String key;
                if (resource.contains("/")) {
                    key = resource.substring(0, resource.indexOf("/"));
                } else {
                    key = resource;
                }
                if (!key.equals(Defaults.TemplateDir) && !keys.contains(key)) {
                    logger.trace(" - found [{}].", key);
                    keys.add(key);
                    indexNames.add(key);
                }
            }
        }

        return indexNames;
    }
806033
List<List<TaskId>> interleaveTasksByGroupId(final Collection<TaskId> taskIds, final int numberThreads) {
    final LinkedList<TaskId> sortedTasks = new LinkedList<>(taskIds);
    Collections.sort(sortedTasks);
    final List<List<TaskId>> taskIdsForConsumerAssignment = new ArrayList<>(numberThreads);
    for (int i = 0; i < numberThreads; i++) {
      taskIdsForConsumerAssignment.add(new ArrayList<>());
    }
    while (!sortedTasks.isEmpty()) {
      for (final List<TaskId> taskIdList : taskIdsForConsumerAssignment) {
        final TaskId taskId = sortedTasks.poll();
        if (taskId == null) {
          break;
        }
        taskIdList.add(taskId);
      }
    }
    return taskIdsForConsumerAssignment;
  }
1042495
public Set<Integer> getUnstoppedSlots(Set<Integer> aliveTasks, Map<String, SupervisorInfo> supInfos,
                                          Assignment existAssignment) {
        Set<Integer> ret = new HashSet<>();

        Set<ResourceWorkerSlot> oldWorkers = existAssignment.getWorkers();
        Set<String> aliveSupervisors = supInfos.keySet();
        for (ResourceWorkerSlot worker : oldWorkers) {
            for (Integer taskId : worker.getTasks()) {
                if (!aliveTasks.contains(taskId)) {
                    // task is dead
                    continue;
                }

                String oldTaskSupervisorId = worker.getNodeId();
                if (!aliveSupervisors.contains(oldTaskSupervisorId)) {
                    // supervisor is dead
                    ret.add(taskId);
                }
            }
        }

        return ret;
    }
902686
private Task findChildTaskByUUID(ChildTaskContainer parent, UUID uuid)
   {
      Task result = null;

      for (Task task : parent.getChildTasks())
      {
         if (uuid.equals(task.getGUID()))
         {
            result = task;
            break;
         }
      }

      return result;
   }
1279558
boolean findTag(long i1, long i2, long tag) {
		for (int i = 0; i < CuckooFilter.BUCKET_SIZE; i++) {
			if (checkTag(i1, i, tag) || checkTag(i2, i, tag))
				return true;
		}
		return false;
	}
733892
public java.util.List<ExportTask> getExportTasks() {
        if (exportTasks == null) {
            exportTasks = new com.amazonaws.internal.SdkInternalList<ExportTask>();
        }
        return exportTasks;
    }
445884
public void setExportTaskIds(java.util.Collection<String> exportTaskIds) {
        if (exportTaskIds == null) {
            this.exportTaskIds = null;
            return;
        }

        this.exportTaskIds = new com.amazonaws.internal.SdkInternalList<String>(exportTaskIds);
    }
547755
private void readTasks(Integer id)
   {
      Integer currentID = id;
      Table table = getTable("WBSTAB");

      while (currentID.intValue() != 0)
      {
         MapRow row = table.find(currentID);
         Task task = m_projectFile.getTaskByUniqueID(row.getInteger("TASK_ID"));
         readLeafTasks(task, row.getInteger("FIRST_CHILD_TASK_ID"));
         Integer childID = row.getInteger("CHILD_ID");
         if (childID.intValue() != 0)
         {
            readTasks(childID);
         }
         currentID = row.getInteger("NEXT_ID");
      }
   }
649687
int getMaxSlots(String poolName, TaskType taskType) {
    Map<String, Integer> maxMap = (taskType == TaskType.MAP ?
                                   poolMaxMaps : poolMaxReduces);
    if (maxMap.containsKey(poolName)) {
      return maxMap.get(poolName);
    } else {
      return Integer.MAX_VALUE;
    }
  }
937570
private Integer mapTaskID(Integer id)
   {
      Integer mappedID = m_clashMap.get(id);
      if (mappedID == null)
      {
         mappedID = id;
      }
      return (mappedID);
   }
975051
public static List<TaskAction> getMyTasksBulkActions() throws IOException, XmlException {
        if (myTasksBulkActions == null) {
            myTasksBulkActions = new ArrayList<TaskAction>();
            for (AllowableAction allowableAction : getTaskActions().getBulkTaskActions().getAssignedBulkActions().getAllowableActionList()) {
                TaskAction taskAction = convertToJsonable(allowableAction);
                if (!myTasksBulkActions.contains(taskAction))
                    myTasksBulkActions.add(taskAction);
            }
        }
        return myTasksBulkActions;
    }
149208
public java.util.List<String> getExportTaskIds() {
        if (exportTaskIds == null) {
            exportTaskIds = new com.amazonaws.internal.SdkInternalList<String>();
        }
        return exportTaskIds;
    }
48814
public List<Integer> getComponentTasks(String componentId) {
    List<Integer> retVal = new LinkedList<>();
    for (Map.Entry<Integer, String> entry : taskToComponentMap.entrySet()) {
      if (entry.getValue().equals(componentId)) {
        retVal.add(entry.getKey());
      }
    }
    return retVal;
  }
88223
public long getTaskCount() {
        final ReentrantLock mainLock = this.mainLock;
        mainLock.lock();
        try {
            long n = completedTaskCount;
            for (Worker w : workers) {
                n += w.completedTasks;
                if (w.isLocked())
                    ++n;
            }
            return n + workQueue.size();
        } finally {
            mainLock.unlock();
        }
    }