Package noaa.coastwatch.util.chunk
Class PoolProcessor
java.lang.Object
noaa.coastwatch.util.chunk.PoolProcessor
- All Implemented Interfaces:
ParallelChunkOperation
The
PoolProcessor class is a ParallelChunkOperation
that operates using a pool of execution threads.- Since:
- 3.4.0
- Author:
- Peter Hollemans
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Cancels a parallel operation in progress.voidinit(List<ChunkPosition> positions, ChunkOperation op) Initializes the parallel operation.voidsetMaxOperations(int ops) Sets the maximum number of operations to run in parallel.voidstart()Starts the parallel operation.voidWaits for completion of a parallel operation.
-
Constructor Details
-
PoolProcessor
public PoolProcessor()
-
-
Method Details
-
setMaxOperations
public void setMaxOperations(int ops) Sets the maximum number of operations to run in parallel. The default is to use the number of available processors reported by the Java runtime.- Parameters:
ops- the maximum number of parallel operations.
-
init
Description copied from interface:ParallelChunkOperationInitializes the parallel operation.- Specified by:
initin interfaceParallelChunkOperation- Parameters:
positions- the list of chunk positions to operate on.op- the chunk operation to perform at each position.
-
start
public void start()Description copied from interface:ParallelChunkOperationStarts the parallel operation.- Specified by:
startin interfaceParallelChunkOperation
-
cancel
public void cancel()Description copied from interface:ParallelChunkOperationCancels a parallel operation in progress. Some instances of chunk operations in progress may take time to complete, but no more operations are started after the call to this method.- Specified by:
cancelin interfaceParallelChunkOperation
-
waitForCompletion
public void waitForCompletion()Description copied from interface:ParallelChunkOperationWaits for completion of a parallel operation. If the parallel operation has been cancelled, this method will also wait for any chunk operations that were already in progress whenParallelChunkOperation.cancel()was called. Otherwise it simply waits until all operations are complete and returns.- Specified by:
waitForCompletionin interfaceParallelChunkOperation
-