Class BoundedExecutors


  • public class BoundedExecutors
    extends java.lang.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)
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.concurrent.ExecutorService newFixedThreadPool​(int nThreads, int boundedQueueSize)
      Creates a thread pool that reuses a fixed set of threads operating off a shared bounded queue.
      static java.util.concurrent.ExecutorService newFixedThreadPool​(int nThreads, java.util.concurrent.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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BoundedExecutors

        public BoundedExecutors()
    • Method Detail

      • newFixedThreadPool

        public static java.util.concurrent.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 java.util.concurrent.ExecutorService newFixedThreadPool​(int nThreads,
                                                                              java.util.concurrent.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