Java ThreadPoolExecutor getWorkerCount(ThreadPoolExecutor workerExecutor)

Here you can find the source of getWorkerCount(ThreadPoolExecutor workerExecutor)

Description

get Worker Count

License

LGPL

Declaration

public static int getWorkerCount(ThreadPoolExecutor workerExecutor) 

Method Source Code


//package com.java2s;
//License from project: LGPL 

import java.util.concurrent.ThreadPoolExecutor;

public class Main {
    /**/*from   w w  w. ja  v a 2  s  . c  om*/
     * Copy of {@link org.jboss.netty.channel.socket.nio.SelectorUtil#DEFAULT_IO_THREADS}
     */
    public static final int DEFAULT_IO_THREADS = Runtime.getRuntime().availableProcessors() * 2;

    public static int getWorkerCount(ThreadPoolExecutor workerExecutor) {
        return Math.min(workerExecutor.getMaximumPoolSize(), DEFAULT_IO_THREADS);
    }
}

Related

  1. getBlockingWorkExecutor()
  2. getBoundedThreadPoolExecutor(int maxPoolSize, long keepAliveTime, TimeUnit unit, ThreadFactory tFactory)
  3. getScheduler()
  4. getThreadPoolExecutor(int poolSize, int[] poolInfo)
  5. getThreadPoolTrace(ThreadPoolExecutor threadpool)
  6. parseRejectionPolicy(String rejection_policy)