code: public synchronized int setMaxEvaluators(final int targetNum) throws UnsuccessfulException {
      if (targetNum < nActiveEval + nRequestedEval) {
        throw new UnsuccessfulException(nActiveEval + nRequestedEval +
            " evaluators are used now. Should be larger than that.");
      }
      nMaxEval = targetNum;
  
      if (scheduler.hasPendingTasks()) {
        final int nToRequest =
            Math.min(scheduler.getNumPendingTasks(), nMaxEval - nActiveEval) - nRequestedEval;
        requestEvaluator(nToRequest);
      }
      return nMaxEval;
    }
docs: Update the maximum number of evaluators to hold.
  Request more evaluators in case there are pending tasks
  in the queue and the number of evaluators is less than the limit.