code: @GuardedBy("hudson.model.Queue.lock")
      private void setNumExecutors(int n) {
          this.numExecutors = n;
          final int diff = executors.size()-n;
  
          if (diff>0) {
              // we have too many executors
              // send signal to all idle executors to potentially kill them off
              // need the Queue maintenance lock held to prevent concurrent job assignment on the idle executors
              Queue.withLock(new Runnable() {
                  @Override
                  public void run() {
                      for( Executor e : executors )
                          if(e.isIdle())
                              e.interrupt();
                  }
              });
          }
  
          if (diff<0) {
              // if the number is increased, add new ones
              addNewExecutorIfNecessary();
          }
      }
docs: Calling path, *means protected by Queue.withLock
  
  Computer.doConfigSubmit -> Computer.replaceBy ->Jenkins.setNodes* ->Computer.setNode
  AbstractCIBase.updateComputerList->Computer.inflictMortalWound*
  AbstractCIBase.updateComputerList->AbstractCIBase.updateComputer* ->Computer.setNode
  AbstractCIBase.updateComputerList->AbstractCIBase.killComputer->Computer.kill
  Computer.constructor->Computer.setNode
  Computer.kill is called after numExecutors set to zero(Computer.inflictMortalWound) so not need the Queue.lock
  
  @param number of executors