I
- the type of the input elements.O
- the type of the output elements.public class ConcurrentPipe<I,O>
extends java.lang.Object
implements java.lang.Runnable
Modifier and Type | Class and Description |
---|---|
static interface |
ConcurrentPipe.InputProducer<I>
A task that produces the input of a
ConcurrentPipe element by element. |
static interface |
ConcurrentPipe.OutputConsumer<O>
A task that consumes the output of a
ConcurrentPipe element by element. |
static interface |
ConcurrentPipe.Processor<I,O>
A task that processes the input of a
ConcurrentPipe element by element. |
Constructor and Description |
---|
ConcurrentPipe(ConcurrentPipe.InputProducer<I> inputProducer,
ConcurrentPipe.Processor<I,O> processor,
ConcurrentPipe.OutputConsumer<O> outputConsumer,
int nThreads,
int queueSize)
Constructs a new concurrent pipe with the given parameters.
|
Modifier and Type | Method and Description |
---|---|
void |
run()
Runs the concurrent pipe.
|
public ConcurrentPipe(ConcurrentPipe.InputProducer<I> inputProducer, ConcurrentPipe.Processor<I,O> processor, ConcurrentPipe.OutputConsumer<O> outputConsumer, int nThreads, int queueSize)
inputProducer
- the task that will produce the input.processor
- the processor to compute the output elements one by one.outputConsumer
- the task that will consume the output.nThreads
- the number of processor tasks that should be run concurrently.queueSize
- the maximum amount of elements to keep in the output queue before ceasing to consume more input until some space is made.