Package org.infinispan.util.concurrent
Class BoundedExecutors
- java.lang.Object
-
- org.infinispan.util.concurrent.BoundedExecutors
-
public class BoundedExecutors extends java.lang.Object
Similar to JDKExecutors
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 Summary
Constructors Constructor Description BoundedExecutors()
-
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.
-
-
-
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 poolboundedQueueSize
- 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 poolthreadFactory
- the factory to use when creating new threadsboundedQueueSize
- size of the bounded queue- Returns:
- the newly created thread pool
-
-