diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/AbstractStage.java b/src/main/java/teetime/variant/methodcallWithPorts/framework/core/AbstractStage.java index f54fa344dceafa4196316e3200ac99cad014b141..8c0584ac40239ab0f7a60b61cf1ea0086a27643f 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/AbstractStage.java +++ b/src/main/java/teetime/variant/methodcallWithPorts/framework/core/AbstractStage.java @@ -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 diff --git a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/Pipeline.java b/src/main/java/teetime/variant/methodcallWithPorts/framework/core/Pipeline.java index 04ec724025bb280854c249b3914eb873598f4e49..596dce3fa42cd1032c1a8fee5a1a0374d483cef2 100644 --- a/src/main/java/teetime/variant/methodcallWithPorts/framework/core/Pipeline.java +++ b/src/main/java/teetime/variant/methodcallWithPorts/framework/core/Pipeline.java @@ -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