Java Utililty Methods Thread Executor Pool

List of utility methods to do Thread Executor Pool

Description

The list of methods to do Thread Executor Pool are organized into topic(s).

Method

voidclearPreloadThreads()
clear Preload Threads
executorService.shutdown();
executorService = Executors.newCachedThreadPool();
ThreadPoolExecutorcreateBoundedCachedThreadPool(final int corePoolSize, final int maximumPoolSize, final long keepAliveTime, final TimeUnit timeUnit)
Creates a ThreadPool for running requests threads.
@SuppressWarnings("serial")
final LinkedBlockingQueue<Runnable> queue = new LinkedBlockingQueue<Runnable>() {
    public boolean offer(final Runnable r) {
        if (size() > 1) {
            return false;
        return super.offer(r);
    };
...
ExecutorServicecreateClientThreadPool(int numThreads, int queueSize)
This creates the client side thread pool for WXS.
LinkedBlockingQueue<Runnable> queue = new LinkedBlockingQueue<Runnable>(queueSize);
ExecutorService p = new ThreadPoolExecutor(numThreads, numThreads, 2L, TimeUnit.MINUTES, queue,
        new ThreadPoolExecutor.CallerRunsPolicy());
return p;
ExecutorServicecreatePool(int threads, int queueSize)
create Pool
return new ThreadPoolExecutor(1, threads, 30, TimeUnit.SECONDS, new LinkedBlockingDeque<>(queueSize),
        new ThreadPoolExecutor.CallerRunsPolicy());
ExecutorServicecreatePooledExecutorService(int poolSize, final String namePrefix)
Creates a pooled ExecutorService of a fixed size and turns all threads to daemons to make sure they do not block application shutdown.
return Executors.newFixedThreadPool(poolSize, new ThreadFactory() {
    final AtomicInteger counter = new AtomicInteger(0);
    @Override
    public Thread newThread(Runnable runnable) {
        final Thread thread = new Thread(runnable);
        thread.setDaemon(true);
        thread.setName(String.format("%s-%d", namePrefix, counter.incrementAndGet()));
        return thread;
...
ThreadPoolExecutorgetPool()
get Pool
return POOL;
ExecutorServicegetPool()
get Pool
return ForkJoinTask.getPool();
ExecutorServicegetQueuedThreadPool(double threadToCpuRatio, int queueCapacity)
get Queued Thread Pool
int workingThreads = Double.valueOf(NUM_CPU * threadToCpuRatio).intValue();
return new ThreadPoolExecutor(workingThreads, workingThreads, 60, TimeUnit.SECONDS,
        new LinkedBlockingQueue<Runnable>(queueCapacity), new ThreadPoolExecutor.CallerRunsPolicy());
ExecutorServicegetRecheckThreadPool()
Returns the MX recheck ThreadPool.
if (recheckThreadPool == null) {
    recheckThreadPool = createBoundedCachedThreadPool(0, CONST_10, CONST_60, TimeUnit.SECONDS);
return recheckThreadPool;
ExecutorServicegetThreadPool()
retrieves a cached thread pool
if (threadPool == null) {
    threadPool = Executors.newCachedThreadPool();
return threadPool;