code: private Worker getWorker() throws InterruptedException {
      while (!courtesyMonitor.allowTasksToRun()) {
        courtesyMonitor.waitFor();
      }
      while (numWorkers > maxWorkers) {
        workerQueue.take();
        numWorkers--;
      }
      return workerQueue.take();
    }
docs: Gets the next worker available to process a task.
  @return The next available worker.
  @throws InterruptedException If the thread is interrupted while waiting
  for an available worker.