Java Thread Executor Create getExecutor(int numTasks, int maxThreads)

Here you can find the source of getExecutor(int numTasks, int maxThreads)

Description

get Executor

License

Apache License

Declaration

public static ExecutorService getExecutor(int numTasks, int maxThreads) 

Method Source Code


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

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Main {
    public static ExecutorService getExecutor(int numTasks, int maxThreads) {
        if (numTasks <= maxThreads) {
            return Executors.newFixedThreadPool(numTasks);
        } else {//  w  ww.  j  a  va 2 s  . com
            return Executors.newFixedThreadPool(maxThreads);
        }
    }
}

Related

  1. createResourceRetrievalService( final String threadName)
  2. createSingleThreadExecutor(final String name)
  3. createStatisticsExecutor()
  4. createThreadFactory(final String prefix)
  5. getExecutor()
  6. getExecutorService()
  7. getExecutorService()
  8. getExecutorService()
  9. getExecutorService(int maximumPoolSize, int corePoolSize, long keepAliveTime, final String name, RejectedExecutionHandler rejectionPolicy)