Skip to content
Snippets Groups Projects
Commit 5e20b567 authored by Christian Wulf's avatar Christian Wulf
Browse files

added cache tasks

parent b93e2ab2
Branches
Tags
No related merge requests found
......@@ -13,7 +13,7 @@ public abstract class AbstractStage<I, O> implements StageWithPort<I, O> {
/**
* A unique logger instance per stage instance
*/
protected Log logger;
protected final Log logger; // BETTER use SLF4J as interface and logback as impl
private final InputPort<I> inputPort = new InputPort<I>(this);
private final OutputPort<O> outputPort = new OutputPort<O>();
......@@ -22,11 +22,6 @@ public abstract class AbstractStage<I, O> implements StageWithPort<I, O> {
private boolean reschedulable;
/**
* cached successor for default output port
*/
private StageWithPort<?, ?> next;
public AbstractStage() {
this.id = UUID.randomUUID().toString(); // the id should only be represented by a UUID, not additionally by the class name
this.logger = LogFactory.getLog(this.getClass().getName() + "(" + this.id + ")");
......@@ -90,7 +85,7 @@ public abstract class AbstractStage<I, O> implements StageWithPort<I, O> {
StageWithPort<?, ?> next = outputPort.getCachedTargetStage();
do {
next.executeWithPorts();
next.executeWithPorts(); // PERFORMANCE use the return value as indicator for re-schedulability instead
} while (next.isReschedulable());
}
......@@ -108,7 +103,6 @@ public abstract class AbstractStage<I, O> implements StageWithPort<I, O> {
@Override
public void onStart() {
// empty default implementation
this.next = (this.outputPort.getPipe() != null) ? this.outputPort.getPipe().getTargetPort().getOwningStage() : null;
}
@Override
......
......@@ -112,27 +112,6 @@ public class Pipeline<I, O> implements StageWithPort<I, O> {
@Override
public void onStart() {
// Pipe pipe = new Pipe();
// this.outputPort.pipe = pipe;
// this.firstStage.getInputPort().pipe = pipe;
// Pipe pipe = new Pipe();
// this.firstStage.getOutputPort().pipe = pipe;
// this.intermediateStages.get(0).getInputPort().pipe = pipe;
//
// for (int i = 0; i < this.intermediateStages.size() - 1; i++) {
// Stage left = this.intermediateStages.get(i);
// Stage right = this.intermediateStages.get(i + 1);
//
// pipe = new Pipe();
// left.getOutputPort().pipe = pipe;
// right.getInputPort().pipe = pipe;
// }
//
// pipe = new Pipe();
// this.intermediateStages.get(this.intermediateStages.size() - 1).getOutputPort().pipe = pipe;
// this.lastStage.getInputPort().pipe = pipe;
int size = 1 + this.intermediateStages.size() + 1;
this.stages = new StageWithPort[size];
this.stages[0] = this.firstStage;
......@@ -180,12 +159,12 @@ public class Pipeline<I, O> implements StageWithPort<I, O> {
@Override
public InputPort<I> getInputPort() {
return this.firstStage.getInputPort();
return this.firstStage.getInputPort(); // CACHE pipeline's input port
}
@Override
public OutputPort<O> getOutputPort() {
return this.lastStage.getOutputPort();
return this.lastStage.getOutputPort(); // CACHE pipeline's output port
}
// TODO remove since it does not increase performances
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment