| java.lang.Object | ||
| ↳ | java.util.concurrent.AbstractExecutorService | |
| ↳ | com.facebook.common.executors.ConstrainedExecutorService | |
Known Direct Subclasses
|
A java.util.concurrent.ExecutorService that delegates to an existing Executor but constrains the number of concurrently executing tasks to a pre-configured value.
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
ConstrainedExecutorService(String name, int maxConcurrency, Executor executor, BlockingQueue<Runnable> workQueue)
Creates a new
ConstrainedExecutorService. | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| boolean | awaitTermination(long timeout, TimeUnit unit) | ||||||||||
| void |
execute(Runnable runnable)
Submit a task to be executed in the future.
| ||||||||||
| boolean |
isIdle()
Determine whether or not the queue is idle.
| ||||||||||
| boolean | isShutdown() | ||||||||||
| boolean | isTerminated() | ||||||||||
| static ConstrainedExecutorService |
newConstrainedExecutor(String name, int maxConcurrency, int queueSize, Executor executor)
Factory method to create a new
ConstrainedExecutorService with an unbounded LinkedBlockingQueue queue. | ||||||||||
| void | shutdown() | ||||||||||
| List<Runnable> | shutdownNow() | ||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.util.concurrent.AbstractExecutorService
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
java.util.concurrent.Executor
| |||||||||||
From interface
java.util.concurrent.ExecutorService
| |||||||||||
Creates a new ConstrainedExecutorService.
| name | Friendly name to identify the executor in logging and reporting. |
|---|---|
| maxConcurrency | Maximum number of tasks to execute in parallel on the delegate executor. |
| executor | Delegate executor for actually running tasks. |
| workQueue | Queue to hold Runnables for eventual execution. |
| InterruptedException |
|---|
Submit a task to be executed in the future.
| runnable | The task to be executed. |
|---|
Determine whether or not the queue is idle.
Factory method to create a new ConstrainedExecutorService with an unbounded LinkedBlockingQueue queue.
| name | Friendly name to identify the executor in logging and reporting. |
|---|---|
| maxConcurrency | Maximum number of tasks to execute in parallel on the delegate executor. |
| queueSize | Number of items that can be queued before new submissions are rejected. |
| executor | Delegate executor for actually running tasks. |
ConstrainedExecutorService instance.