public class OperationPool extends java.lang.Object implements IOperator
Constructor and Description |
---|
OperationPool(int defaultThreads)
Creates an operation pool with an unlimited number of threads
and the specified number of default threads.
|
OperationPool(int defaultThreads,
int maximumThreads)
Creates an operation pool with the specified number of default
threads that will be hold even if no operations must be executed
and the specified number of maximum threads.
|
Modifier and Type | Method and Description |
---|---|
void |
performOperation(IOperation operation)
Executes the specified operation using a default monitor.
|
void |
performOperation(IOperation operation,
IMonitor monitor)
Executes the specified operation using the specified monitor.
|
void |
shutdown()
Performs a shutdown on the pool.
|
public OperationPool(int defaultThreads)
defaultThreads
- The default number of threads that
will be kept, set to 0 to remove all threads after an
operation has been executed.java.lang.IllegalArgumentException
- Thrown if the default number
of threads is negative.public OperationPool(int defaultThreads, int maximumThreads)
defaultThreads
- The number of threads that will be kept even
if no operations need to be executed, set to 0 to remove all
threads after they have been created.maximumThreads
- The number of threads that will be created.
Set to 0 to allow an unlimited number of new threads.java.lang.IllegalArgumentException
- Thrown if the default number or
the maximum number of threads is negative.public void performOperation(IOperation operation)
performOperation
in interface IOperator
operation
- The operation to execute.public void performOperation(IOperation operation, IMonitor monitor)
performOperation
in interface IOperator
operation
- The operation to execute.monitor
- The monitor used by the operation.public void shutdown()