List and explain all the parameters for the following constructor of the ThreadPoolExecutor.

List and explain all the parameters for the following constructor of the ThreadPoolExecutor.


ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler)

corePoolSize: number of threads to keep in the pool unless allowCoreThreadTimeOut(boolean value) with a true value

maximumPoolSize: maximum number of threads allowed in the pool

keepAliveTime: when the number of threads is greater than the core, this is the maximum time that excess idle threads will wait for new tasks before terminating.

unit: time unit for the keepAliveTime argument.

workQueue: queue used for holding tasks before they are executed; this queue will hold only the Runnable objects submitted by the execute() method

threadFactory: is the factory to use when the executor creates a new thread

handler: is the handler to use when the execution is blocked because the thread bounds and queue capacities are reached.


Learn More :

Multithreading and Concurrent Processing

Learn More Multiple Choice Question :