예제 #1
0
  private synchronized void addNewEntrants() {
    int running = allSplits.size();
    for (int i = 0; i < minimumNumberOfTasks - running; i++) {
      PrioritizedSplitRunner split = pollNextSplitWorker();
      if (split == null) {
        break;
      }

      queuedTime.add(System.nanoTime() - split.createdNanos);
      startSplit(split);
    }
  }
예제 #2
0
 private synchronized void scheduleTaskIfNecessary(TaskHandle taskHandle) {
   // if task has less than the minimum guaranteed splits running,
   // immediately schedule a new split for this task.  This assures
   // that a task gets its fair amount of consideration (you have to
   // have splits to be considered for running on a thread).
   if (taskHandle.getRunningSplits() < GUARANTEED_SPLITS_PER_TASK) {
     PrioritizedSplitRunner split = taskHandle.pollNextSplit();
     if (split != null) {
       startSplit(split);
       queuedTime.add(System.nanoTime() - split.createdNanos);
     }
   }
 }
예제 #3
0
  private synchronized void splitFinished(PrioritizedSplitRunner split) {
    allSplits.remove(split);
    pendingSplits.remove(split);

    TaskHandle taskHandle = split.getTaskHandle();
    taskHandle.splitComplete(split);

    wallTime.add(System.nanoTime() - split.createdNanos);

    scheduleTaskIfNecessary(taskHandle);

    addNewEntrants();
  }