code: protected void startQueue(GerritWorkersConfig config) {
          if (executor == null) {
              logger.debug("Starting the sending thread pool.");
              executor = new ThreadPoolExecutor(
                      config.getNumberOfSendingWorkerThreads(),
                      config.getNumberOfSendingWorkerThreads(),
                      THREAD_KEEP_ALIVE_TIME, TimeUnit.MINUTES,
                      new LinkedBlockingQueue<Runnable>(),
                      new ThreadFactory() {
                          private final ThreadFactory parent = Executors.defaultThreadFactory();
                          private final AtomicInteger tid = new AtomicInteger(1);
  
                          @Override
                          public Thread newThread(final Runnable task) {
                            final Thread t = parent.newThread(task);
                            t.setName(THREAD_PREFIX + tid.getAndIncrement());
                            return t;
                          }
                        });
              executor.allowCoreThreadTimeOut(true);
              //Start with one thread, and build it up gradually as it needs.
              executor.prestartCoreThread();
              logger.info("SendQueue started! Current pool size: {}", executor.getPoolSize());
          } else {
              if (executor.getCorePoolSize() < config.getNumberOfSendingWorkerThreads()) {
                  //If the number has increased we need to set the max first, or we'll get an IllegalArgumentException
                  executor.setMaximumPoolSize(config.getNumberOfSendingWorkerThreads());
                  executor.setCorePoolSize(config.getNumberOfSendingWorkerThreads());
              } else if (executor.getCorePoolSize() > config.getNumberOfSendingWorkerThreads()) {
                  //If the number has decreased we need to set the core first.
                  executor.setCorePoolSize(config.getNumberOfSendingWorkerThreads());
                  executor.setMaximumPoolSize(config.getNumberOfSendingWorkerThreads());
              }
              logger.debug("SendQueue running. Current pool size: {}. Current Queue size: {}",
                      executor.getPoolSize(), getQueueSize());
              logger.debug("Nr of active pool-threads: {}", executor.getActiveCount());
          }
      }
docs: Starts the executor if it hasn't started yet, or updates the thread-pool size if it is started.
  
  @param config the config with the pool-size.