protected List<TaskInProgress> findSpeculativeTaskCandidatesUnprotected(
      Collection<TaskInProgress> list) {
    ArrayList<TaskInProgress> candidates = new ArrayList<TaskInProgress>();

    long now = clock.getTime();
    Iterator<TaskInProgress> iter = list.iterator();
    while (iter.hasNext()) {
      TaskInProgress tip = iter.next();
      if (tip.canBeSpeculated(now)) {
        candidates.add(tip);
      }
    }
    if (candidates.size() > 0 ) {
      Comparator<TaskInProgress> LateComparator =
        new JobInProgress.EstimatedTimeLeftComparator(now);

      Collections.sort(candidates, LateComparator);
    }
    return candidates;
  }
protected List < TaskInProgress > findSpeculativeTaskCandidatesUnprotected ( Collection < TaskInProgress > list ) { ArrayList < TaskInProgress > candidates = new ArrayList < TaskInProgress > ( ) ; long now = clock . getTime ( ) ; Iterator < TaskInProgress > iter = list . iterator ( ) ; while ( iter . hasNext ( ) ) { TaskInProgress tip = iter . next ( ) ; if ( tip . canBeSpeculated ( now ) ) { candidates . add ( tip ) ; } } if ( candidates . size ( ) > 0 ) { Comparator < TaskInProgress > LateComparator = new JobInProgress . EstimatedTimeLeftComparator ( now ) ; Collections . sort ( candidates , LateComparator ) ; } return candidates ; }
Given a candidate set of tasks, find and order the ones that
can be speculated and return the same.