Class BoundedExecutors

java.lang.Object
org.infinispan.util.concurrent.BoundedExecutors

public class BoundedExecutors extends Object
Similar to JDK Executors except that the factory methods here allow you to specify the size of the blocking queue that backs the executor.
Since:
4.0
Author:
Manik Surtani (manik AT jboss DOT org)
  • Constructor Details

    • BoundedExecutors

      public BoundedExecutors()
  • Method Details

    • newFixedThreadPool

      public static ExecutorService newFixedThreadPool(int nThreads, int boundedQueueSize)
      Creates a thread pool that reuses a fixed set of threads operating off a shared bounded queue. If any thread terminates due to a failure during execution prior to shutdown, a new one will take its place if needed to execute subsequent tasks.
      Parameters:
      nThreads - the number of threads in the pool
      boundedQueueSize - size of the bounded queue
      Returns:
      the newly created thread pool
    • newFixedThreadPool

      public static ExecutorService newFixedThreadPool(int nThreads, ThreadFactory threadFactory, int boundedQueueSize)
      Creates a thread pool that reuses a fixed set of threads operating off a shared bounded queue, using the provided ThreadFactory to create new threads when needed.
      Parameters:
      nThreads - the number of threads in the pool
      threadFactory - the factory to use when creating new threads
      boundedQueueSize - size of the bounded queue
      Returns:
      the newly created thread pool