Class PoolProcessor

java.lang.Object
noaa.coastwatch.util.chunk.PoolProcessor
All Implemented Interfaces:
ParallelChunkOperation

public class PoolProcessor extends Object implements ParallelChunkOperation
The PoolProcessor class is a ParallelChunkOperation that operates using a pool of execution threads.
Since:
3.4.0
Author:
Peter Hollemans
  • 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

      public void init(List<ChunkPosition> positions, ChunkOperation op)
      Description copied from interface: ParallelChunkOperation
      Initializes the parallel operation.
      Specified by:
      init in interface ParallelChunkOperation
      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: ParallelChunkOperation
      Starts the parallel operation.
      Specified by:
      start in interface ParallelChunkOperation
    • cancel

      public void cancel()
      Description copied from interface: ParallelChunkOperation
      Cancels 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:
      cancel in interface ParallelChunkOperation
    • waitForCompletion

      public void waitForCompletion()
      Description copied from interface: ParallelChunkOperation
      Waits 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 when ParallelChunkOperation.cancel() was called. Otherwise it simply waits until all operations are complete and returns.
      Specified by:
      waitForCompletion in interface ParallelChunkOperation