Class BalancingExecutor
java.lang.Object
org.jboss.threads.BalancingExecutor
- All Implemented Interfaces:
Executor
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new instance.BalancingExecutor(Executor... executors) Construct a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExecutor(Executor executor) Add a delegate executor.voidclear()Clear out all delegate executors at once.voidExecute a task.voidremoveExecutor(Executor executor) Remove a delegate executor.
-
Constructor Details
-
BalancingExecutor
public BalancingExecutor()Construct a new instance. -
BalancingExecutor
Construct a new instance.- Parameters:
executors- the initial list of executors to delegate to
-
-
Method Details
-
execute
Execute a task.- Specified by:
executein interfaceExecutor- Parameters:
command- the task to execute- Throws:
RejectedExecutionException- if no executors are available to run the task
-
clear
public void clear()Clear out all delegate executors at once. Tasks will be rejected until another delegate executor is added. -
addExecutor
Add a delegate executor.- Parameters:
executor- the executor to add
-
removeExecutor
Remove a delegate executor.- Parameters:
executor- the executor to remove
-