diff --git a/src/test/java/teetime/examples/throughput/methodcall/AbstractStage.java b/src/test/java/teetime/examples/throughput/methodcall/AbstractStage.java index 9b8712eb3822ff803cfea3801f8826cd00343ace..9814f30ff0dd8a670583f9a3cb95750f7a486352 100644 --- a/src/test/java/teetime/examples/throughput/methodcall/AbstractStage.java +++ b/src/test/java/teetime/examples/throughput/methodcall/AbstractStage.java @@ -2,32 +2,8 @@ package teetime.examples.throughput.methodcall; public abstract class AbstractStage<I, O> implements Stage<I, O> { - Runnable inputPortIsUsed = new Runnable() { - @Override - public void run() { - // pass through the end signal - I element = AbstractStage.this.getInputPort().read(); - if (element == END_SIGNAL) { - AbstractStage.this.getOutputPort().send((O) END_SIGNAL); - return; - } - - AbstractStage.this.execute3(); - } - }; - - Runnable inputPortIsNotUsed = new Runnable() { - @Override - public void run() { - // do not check - - AbstractStage.this.execute3(); - } - }; - private final InputPort<I> inputPort = new InputPort<I>(); private final OutputPort<O> outputPort = new OutputPort<O>(); - protected Runnable endSignalCheck = this.inputPortIsUsed; @Override public InputPort<I> getInputPort() { @@ -41,8 +17,20 @@ public abstract class AbstractStage<I, O> implements Stage<I, O> { @Override public final void execute2() { - this.endSignalCheck.run(); + // pass through the end signal + InputPort<I> port = this.getInputPort(); + if (port.pipe != null) { + I element = port.read(); + if (element == END_SIGNAL) { + this.getOutputPort().send((O) END_SIGNAL); + return; + } + } + + this.execute3(); } protected abstract void execute3(); + + // protected abstract O[] execute4(I[] elements, int size); } diff --git a/src/test/java/teetime/examples/throughput/methodcall/ObjectProducer.java b/src/test/java/teetime/examples/throughput/methodcall/ObjectProducer.java index bcb19d0fdfd8e5f791a1f220ea157faad70e1745..0e7b0d772e0541842bdf29b154ceadb0e8d18061 100644 --- a/src/test/java/teetime/examples/throughput/methodcall/ObjectProducer.java +++ b/src/test/java/teetime/examples/throughput/methodcall/ObjectProducer.java @@ -33,8 +33,6 @@ public class ObjectProducer<T> extends AbstractStage<Void, T> { public ObjectProducer(final long numInputObjects, final Callable<T> inputObjectCreator) { this.numInputObjects = numInputObjects; this.inputObjectCreator = inputObjectCreator; - - this.endSignalCheck = this.inputPortIsNotUsed; } public T execute() {