Module id.xfunction

Class BlockingExecutorService

Object
AbstractExecutorService
BlockingExecutorService
All Implemented Interfaces:
AutoCloseable, Executor, ExecutorService

public class BlockingExecutorService extends AbstractExecutorService
BlockingExecutorService keeps pool of worker threads which read tasks from the blocking queue.

If blocking queue is bounded then thread submitting a new task to this executor will block until new space in queue became available (with standard ThreadPoolExecutor such task will be rejected).

  • Constructor Details

    • BlockingExecutorService

      public BlockingExecutorService(int maximumPoolSize, int capacity)
      Creates executor with bounded queue of given capacity.
      Parameters:
      maximumPoolSize - number of worker threads which will be created and be waiting for a new tasks
      capacity - size of the internal queue from which worker will pick up the tasks
    • BlockingExecutorService

      public BlockingExecutorService(int capacity)
  • Method Details