code: private void startPartitions(List<Integer> partitionsToExecute,
                                   List<Integer> startedPartitions,
                                   List<Integer> finishedPartitions,
                                   PartitionPlanDescriptor currentPlan) {
  
          while (startedPartitions.size() < partitionsToExecute.size()
                 && startedPartitions.size() - finishedPartitions.size() < currentPlan.getThreads()) {
  
              int nextPartitionNumber = partitionsToExecute.get(startedPartitions.size());
              PartitionPlanConfig config = buildPartitionPlanConfig(currentPlan, nextPartitionNumber);
  
              Boolean nextPartitionStarted = null;
              StopLock stopLock = getStopLock(); // Store in local variable to facilitate Ctrl+Shift+G search in Eclipse
              synchronized (stopLock) {
                  nextPartitionStarted = startPartition(config);
              }
  
              if (nextPartitionStarted) {
                  startedPartitions.add(nextPartitionNumber);
              } else {
                  // The partition wasn't started (probably because we're stopping).
                  // Add the partitionNumber to both the started and finished lists,
                  // so that the while-loop logic works as expected.
                  startedPartitions.add(nextPartitionNumber);
                  finishedPartitions.add(nextPartitionNumber);
              }
          }
      }
docs: Keep starting partitions until either..
  (a) they've all been started or
  (b) we reach max threads