Sets the maximum number of concurrent workers.
@param maxWorkers The maximum number of concurrent workers.
491455
public void setMaxWorkers(int maxWorkers) {
    synchronized (workerQueue) {
      idleLock.lock();
      try {
        int oldMaxWorkers = this.maxWorkers;
        this.maxWorkers = maxWorkers;

        // If the number of workers is being reduced, then signal any
        // waiting workers so that they can terminate themselves if
        // their id is greater than the number of workers, and so that
        // another worker can take over idle polling if the current
        // polling worker is to be terminated.
        if (maxWorkers < oldMaxWorkers) {
          idleComplete.signalAll();
        }
      } finally {
        idleLock.unlock();
      }
      while (numWorkers < maxWorkers) {
        String title = String.format("Worker (%d)", numWorkers + 1);
        ProgressMonitorWrapper monitor = new ProgressMonitorWrapper(numWorkers++, monitorFactory.createProgressMonitor(title));
        workerQueue.add(new Worker(monitor));
      }
    }
  }
980583
public void setChildrenMax(int max) {
        addField(ConfigureNodeFields.children_max, FormField.Type.text_single);
        setAnswer(ConfigureNodeFields.children_max.getFieldName(), max);
    }
500419
public function setMaximumIterations($maxIterations)
    {
        if (null === $maxIterations) {
            $this->maxIterations = null;
        } else if (is_numeric($maxIterations) && 0 < intval($maxIterations)) {
            $this->maxIterations = intval($maxIterations);
        } else {
            throw new \InvalidArgumentException(
                '$maxIterations must be null or integer number of iterations greater than 0'
            );
        }
    }
859717
public static void setNumberOfThreads(Job job, int threads) {
        job.getConfiguration().setInt(ConfigConstants.CONF_THREADS_PER_SPLIT,
            threads);
    }
581987
public void setMaxParallelism(int maxParallelism) {
		Preconditions.checkArgument(maxParallelism > 0
						&& maxParallelism <= StreamGraphGenerator.UPPER_BOUND_MAX_PARALLELISM,
				"Maximum parallelism must be between 1 and " + StreamGraphGenerator.UPPER_BOUND_MAX_PARALLELISM
						+ ". Found: " + maxParallelism);
		this.maxParallelism = maxParallelism;
	}
634706
@Nonnull
  public FineUploader5Core setMaxConnections (@Nonnegative final int nMaxConnections)
  {
    ValueEnforcer.isGT0 (nMaxConnections, "MaxConnections");
    m_nCoreMaxConnections = nMaxConnections;
    return this;
  }
59334
public void stopWorkers() throws Exception {
    if (mWorkers == null) {
      return;
    }
    for (WorkerProcess worker : mWorkers) {
      worker.stop();
    }
    for (Thread thread : mWorkerThreads) {
      while (thread.isAlive()) {
        LOG.info("Stopping thread {}.", thread.getName());
        thread.interrupt();
        thread.join(1000);
      }
    }
    mWorkerThreads.clear();
  }
1035124
def set_max_threads(self, max_threads):
        
        if max_threads is None:
            raise TypeError('max_threads must not be None.')
        self._check_if_ready()
        self.collection.set_max_working(max_threads)
1216093
public void setProcessorMaxThreads(int maxThreads) {
        if (processor.getCorePoolSize() > maxThreads) {
            processor.setCorePoolSize(maxThreads);
        }
        processor.setMaximumPoolSize(maxThreads);
    }
943366
private void doWakeUpWorker() {
        if (idleWorkers.get() == 0) {
            synchronized (workers) {
            	if (workers.size() >= getMaximumPoolSize()) {
                    return;
                }
                if (workers.isEmpty() || (idleWorkers.get() == 0)) {
                	addWorkerUnsafe();
                }
            }
        }
    }
989059
@Nonnull
  public FineUploader5Retry setMaxAutoAttempts (@Nonnegative final int nMaxAutoAttempts)
  {
    ValueEnforcer.isGE0 (nMaxAutoAttempts, "MaxAutoAttempts");
    m_nRetryMaxAutoAttempts = nMaxAutoAttempts;
    return this;
  }
665425
public void setMaxNoOfMajorTicks(final int MAX_NO_OF_MAJOR_TICKS) {
        if (MAX_NO_OF_MAJOR_TICKS > 20) {
            this.maxNoOfMajorTicks = 20;
        } else if (MAX_NO_OF_MAJOR_TICKS < 2) {
            this.maxNoOfMajorTicks = 2;
        } else {
            this.maxNoOfMajorTicks = MAX_NO_OF_MAJOR_TICKS;
        }
        calculate();
        fireStateChanged();
    }
76097
@CommandArgument
  public void setcpus(int numberOfCpus) {
    if (worker == null) {
      System.err.println("Worker not running.");
      return;
    }
    int availableCpus = Runtime.getRuntime().availableProcessors();
    if (numberOfCpus <= 0 || numberOfCpus > availableCpus) {
      numberOfCpus = availableCpus;
    }
    System.out.printf("Setting number of CPUs to %d\n", numberOfCpus);
    worker.setMaxWorkers(numberOfCpus);
  }
978266
public void setWorkteams(java.util.Collection<Workteam> workteams) {
        if (workteams == null) {
            this.workteams = null;
            return;
        }

        this.workteams = new java.util.ArrayList<Workteam>(workteams);
    }
940441
def createWorkers(self, num_workers):
        
        for i in range(num_workers):
            self.workers.append(WorkerThread(self._requests_queue))
942635
public void setMaxProgress(int newMaxProgress) {
        if (getProgress() <= newMaxProgress) {
            maxProgress = newMaxProgress;
        }
        else {
            throw new IllegalArgumentException(
                    String.format("MaxProgress cant be smaller than the current progress %d<%d", getProgress(), newMaxProgress));
        }
        invalidate();
        BootstrapProgressBarGroup parent = (BootstrapProgressBarGroup) getParent();
    }
595200
public void setMinMaxLength(int[] lengths) {
    Arrays.sort(lengths);
    this.minLength = lengths[0];
    this.maxLength = lengths[lengths.length - 1];
  }