net.sf.jabb.util.parallel.Pipeline Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jabb-core-java8 Show documentation
Show all versions of jabb-core-java8 Show documentation
Additions to jabb-core that require Java 8
/**
*
*/
package net.sf.jabb.util.parallel;
import java.util.concurrent.Future;
/**
* A pipeline is a set of data processing elements connected in series,
* where the output of one element is the input of the next one.
* The elements of a pipeline are often executed in parallel.
*
* @author James Hu
*
*/
public interface Pipeline {
/**
* Feed an input, and get a future of the final result in return.
* @param input the input
* @return future of the final result.
*/
Future feed(I input);
/**
* The intermediate output between two connected pipelines.
* @author James
*
* @param Type of the output from the upstream pipeline
* @param Type of the output from the downstream pipeline
*/
public static class IntermediateOutput{
O1 outputFromUpstream;
Future futureFromDownstream;
IntermediateOutput(O1 output, Future future){
this.outputFromUpstream = output;
this.futureFromDownstream = future;
}
public O1 getOutputFromUpstream() {
return outputFromUpstream;
}
public Future getFutureFromDownstream() {
return futureFromDownstream;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy