code: public static ExecutorService build(PoolType type, ThreadFactory factory) {
          int corePoolSize, maximumPoolSize;
          int keepAliveTime = 10;
          BlockingQueue<Runnable> workQueue = new LinkedBlockingQueue<>();
          switch (type) {
              case Singleton:
                  corePoolSize = maximumPoolSize = 1;
                  break;
              case IO:
                  corePoolSize = Runtime.getRuntime().availableProcessors() * 10;
                  maximumPoolSize = Runtime.getRuntime().availableProcessors() * 20;
                  break;
              case Calc:
                  corePoolSize = maximumPoolSize = Runtime.getRuntime().availableProcessors() + 1;
                  break;
              default:
                  throw new IllegalArgumentException(
                      String.format("内部异常，未知线程池类型[%s]", type.toString()));
          }
          return new ThreadPoolExecutor(corePoolSize, maximumPoolSize, keepAliveTime,
              TimeUnit.SECONDS, workQueue, factory, DEFAULT_HANDLER);
      }
docs: 构建指定类型的线程池
  @param type 线程池类型
  @param factory 线程工厂，用来构建线程
  @return 线程池