public static ExecutorService createPool(PoolType type, String format) {
        //检查是否符合格式
        String.format(format, 0);
        //线程工厂
        ThreadFactory factory = new ThreadFactory() {
            AtomicInteger counter = new AtomicInteger(0);

            @Override
            public Thread newThread(Runnable r) {
                return new Thread(r, String.format(format, counter.getAndAdd(1)));
            }
        };

        return build(type, factory);
    }
public static ExecutorService createPool ( PoolType type , String format ) { String . format ( format , 0 ) ; ThreadFactory factory = new ThreadFactory ( ) { AtomicInteger counter = new AtomicInteger ( 0 ) ; @ Override public Thread newThread ( Runnable r ) { return new Thread ( r , String . format ( format , counter . getAndAdd ( 1 ) ) ) ; } } ; return build ( type , factory ) ; }
创建指定类型的线程池

@param type   线程池类型
@param format 线程名格式，格式为：format-%d，其中%d将被替换为从0开始的数字序列，不能为null
@return 返回指定类型的线程池