Class BlockingThreadPoolExecutor

  • All Implemented Interfaces:
    Executor, ExecutorService

    public class BlockingThreadPoolExecutor
    extends ThreadPoolExecutor
    A ThreadPoolExecutor which blocks when the queue of items to be executed becomes full.
    Author:
    David B. Bracewell
    • Constructor Detail

      • BlockingThreadPoolExecutor

        public BlockingThreadPoolExecutor​(int corePoolSize,
                                          int maximumPoolSize,
                                          int maxQueueSize)
        Creates an executor with a given core and max pool size and maximum number of items to have waiting in the queue. All threads will execute until completion or failure.
        Parameters:
        corePoolSize - core pool size
        maximumPoolSize - max pools size
        maxQueueSize - max number of items to have waiting (good for memory)
      • BlockingThreadPoolExecutor

        public BlockingThreadPoolExecutor​(int corePoolSize,
                                          int maximumPoolSize,
                                          int maxQueueSize,
                                          long keepAliveTime,
                                          TimeUnit unit)
        Creates an executor with a given core and max pool size and maximum number of items to have waiting in the queue. All threads will execute until completion or the keep alive time runs out.
        Parameters:
        corePoolSize - core pool size
        maximumPoolSize - max pools size
        maxQueueSize - max number of items to have waiting (good for memory)
        keepAliveTime - the amount of time to let the thread run
        unit - the time unit associated with keepAliveTime