Package org.infinispan.util.concurrent
Class BoundedExecutors
java.lang.Object
org.infinispan.util.concurrent.BoundedExecutors
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ExecutorService
newFixedThreadPool
(int nThreads, int boundedQueueSize) Creates a thread pool that reuses a fixed set of threads operating off a shared bounded queue.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.
-
Constructor Details
-
BoundedExecutors
public BoundedExecutors()
-
-
Method Details
-
newFixedThreadPool
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 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 poolthreadFactory
- the factory to use when creating new threadsboundedQueueSize
- size of the bounded queue- Returns:
- the newly created thread pool
-