code: public static ScalingThreadPoolExecutor newScalingThreadPool(int min, int max, long keepAliveTime,
        ThreadFactory threadFactory) {
      ScalingQueue queue = new ScalingQueue();
      ScalingThreadPoolExecutor executor =
          new ScalingThreadPoolExecutor(min, max, keepAliveTime, TimeUnit.MILLISECONDS, queue, threadFactory);
      executor.setRejectedExecutionHandler(new ForceQueuePolicy());
      queue.setThreadPoolExecutor(executor);
      return executor;
    }
docs: Creates a {@link ScalingThreadPoolExecutor}.
  @param min Core thread pool size.
  @param max Max number of threads allowed.
  @param keepAliveTime Keep alive time for unused threads in milliseconds.
  @param threadFactory thread factory to use.
  @return A {@link ScalingThreadPoolExecutor}.