public class PoolProcessor extends java.lang.Object implements ParallelChunkOperation
PoolProcessor
class is a ParallelChunkOperation
that operates using a pool of execution threads.Constructor and Description |
---|
PoolProcessor() |
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancels a parallel operation in progress.
|
void |
init(java.util.List<ChunkPosition> positions,
ChunkOperation op)
Initializes the parallel operation.
|
void |
setMaxOperations(int ops)
Sets the maximum number of operations to run in parallel.
|
void |
start()
Starts the parallel operation.
|
void |
waitForCompletion()
Waits for completion of a parallel operation.
|
public void setMaxOperations(int ops)
ops
- the maximum number of parallel operations.public void init(java.util.List<ChunkPosition> positions, ChunkOperation op)
ParallelChunkOperation
init
in interface ParallelChunkOperation
positions
- the list of chunk positions to operate on.op
- the chunk operation to perform at each position.public void start()
ParallelChunkOperation
start
in interface ParallelChunkOperation
public void cancel()
ParallelChunkOperation
cancel
in interface ParallelChunkOperation
public void waitForCompletion()
ParallelChunkOperation
ParallelChunkOperation.cancel()
was called. Otherwise
it simply waits until all operations are complete and returns.waitForCompletion
in interface ParallelChunkOperation