Returns a new thread pool configured with the default settings.

@return A new thread pool configured with the default settings.
778611
public static ThreadPoolExecutor createDefaultExecutorService() {
        ThreadFactory threadFactory = new ThreadFactory() {
            private int threadCount = 1;

            public Thread newThread(Runnable r) {
                Thread thread = new Thread(r);
                thread.setName("s3-transfer-manager-worker-" + threadCount++);
                return thread;
            }
        };
        return (ThreadPoolExecutor)Executors.newFixedThreadPool(10, threadFactory);
    }
792034
public static Factory newInstance() {
        ScheduledExecutorService scheduler = newSingleThreadScheduledExecutor(new ThreadFactory() {
            public Thread newThread(Runnable r) {
                Thread result = new Thread(r);
                result.setDaemon(true);
                return result;
            }
        });
        Properties props = new Properties();
        return new DefaultFactory(scheduler, props);
    }
28038
public static ScheduledThreadPoolExecutor buildDefaultTimeoutThreadPool(final String name) {
        ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(5, getThreadFactory(name));
        safeSetRemoveOnCancel(executor);
        executor.setKeepAliveTime(5, TimeUnit.SECONDS);
        executor.allowCoreThreadTimeOut(true);

        return executor;
    }
475947
public function threadPool()
    {
        $request = $this->createRequestInstance(self::CAT_THREAD_POOL, null, null);

        return $this->client->send($request);
    }
38648
public static ExecutorService newWorkStealingPool() {
        return new ForkJoinPool
            (Runtime.getRuntime().availableProcessors(),
             ForkJoinPool.defaultForkJoinWorkerThreadFactory,
             null, true);
    }
909873
@SuppressWarnings("unused")
  public static ExecutorService setDefaultThreadPool(ExecutorService threadPool) {
    ExecutorService oldThreadPool = HttpExecutorFactory.threadPool;
    HttpExecutorFactory.threadPool = threadPool;
    return oldThreadPool;
  }
442337
@Nonnull
    public static synchronized ScheduledExecutorService get() {
        if (executorService == null) {
            // corePoolSize is set to 10, but will only be created if needed.
            // ScheduledThreadPoolExecutor "acts as a fixed-sized pool using corePoolSize threads"
            // TODO consider also wrapping in ContextResettingExecutorService
             executorService = new ImpersonatingScheduledExecutorService(new ErrorLoggingScheduledThreadPoolExecutor(10, new NamingThreadFactory(new ClassLoaderSanityThreadFactory(new DaemonThreadFactory()), "jenkins.util.Timer")), ACL.SYSTEM);
        }
        return executorService;
    }
1116887
public static ExecutorService newSingleThreadPoolExecutor() {
        ExecutorService singleThreadPoolExecutor = Executors.newSingleThreadExecutor();
        EXECUTORS.add(singleThreadPoolExecutor);
        return singleThreadPoolExecutor;
    }
637589
public <T extends ThreadPoolTaskExecutor> T configure(T taskExecutor) {
		PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
		map.from(this.queueCapacity).to(taskExecutor::setQueueCapacity);
		map.from(this.corePoolSize).to(taskExecutor::setCorePoolSize);
		map.from(this.maxPoolSize).to(taskExecutor::setMaxPoolSize);
		map.from(this.keepAlive).asInt(Duration::getSeconds)
				.to(taskExecutor::setKeepAliveSeconds);
		map.from(this.allowCoreThreadTimeOut).to(taskExecutor::setAllowCoreThreadTimeOut);
		map.from(this.awaitTermination)
				.to(taskExecutor::setWaitForTasksToCompleteOnShutdown);
		map.from(this.awaitTerminationPeriod).asInt(Duration::getSeconds)
				.to(taskExecutor::setAwaitTerminationSeconds);
		map.from(this.threadNamePrefix).whenHasText()
				.to(taskExecutor::setThreadNamePrefix);
		map.from(this.taskDecorator).to(taskExecutor::setTaskDecorator);
		if (!CollectionUtils.isEmpty(this.customizers)) {
			this.customizers.forEach((customizer) -> customizer.customize(taskExecutor));
		}
		return taskExecutor;
	}
59597
public static ForkJoinPool getPool() {
        Thread t = Thread.currentThread();
        return (t instanceof ForkJoinWorkerThread) ?
            ((ForkJoinWorkerThread) t).pool : null;
    }
652621
public int getThreadsPriority()
    {
        int priority=Thread.NORM_PRIORITY;
        Object o=_pool.getAttribute(__PRIORITY);
        if(o!=null)
        {
            priority=((Integer)o).intValue();
        }
        return priority;
    }
460136
protected ThreadFactory getThreadFactory() {
        return 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;
            }
          };
    }
125627
private ExecutorService getExecutorService(){
        if (executors == null) {
            try {
                executors = Executors.newCachedThreadPool();
            } catch (Exception e) {
                HMSAgentLog.e("create thread service error:" + e.getMessage());
            }
        }

        return executors;
    }
582887
public ThreadContext getThreadContext() {
        if (useInheritableThreadLocal && !SSLConfigManager.getInstance().isServerProcess()) {
            ThreadContext context = inheritableThreadLocStorage.get();

            if (context == null) {
                context = new ThreadContext();
                inheritableThreadLocStorage.set(context);
            }
            return context;
        }
        ThreadContext context = threadLocStorage.get();

        if (context == null) {
            context = new ThreadContext();
            threadLocStorage.set(context);
        }

        return context;
    }
449962
public Map<String, ThreadPoolStatus> getStatusOfThreadPools(){
		Map<String, ThreadPoolStatus> result = new TreeMap<String, ThreadPoolStatus>();
		for (Map.Entry<String, ? extends ThreadPoolExecutor> entry: threadPools.entrySet()){
			ThreadPoolStatus status = new ThreadPoolStatus();
			status.setName(entry.getKey());
			ThreadPoolExecutor pool = entry.getValue();
			status.setActive(pool.getActiveCount());
			status.setKeepAliveSeconds(pool.getKeepAliveTime(TimeUnit.SECONDS));
			status.setLargestSize(pool.getLargestPoolSize());
			status.setMaxSize(pool.getMaximumPoolSize());
			status.setSize(pool.getPoolSize());
			status.setQueueLength(pool.getQueue().size());
			result.put(entry.getKey(), status);
		}
		return result;
	}
567984
public static ThreadPoolExecutor newFixedThreadPool(int corePoolSize) {
        return new ThreadPoolExecutor(corePoolSize,
            corePoolSize,
            0,
            TimeUnit.MILLISECONDS,
            new SynchronousQueue<Runnable>());
    }
315742
def pool(self):
        
        if self._pool is None:
            self._pool = ThreadPool(self.pool_threads)
        return self._pool