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

added cache tasks

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