diff --git a/src/main/java/teetime/framework/AbstractRunnableStage.java b/src/main/java/teetime/framework/AbstractRunnableStage.java index a5d537c2c89629975cfbdb6d62801bda249e010b..535503166b3b564d2a1fa106f51e9daf992993a9 100644 --- a/src/main/java/teetime/framework/AbstractRunnableStage.java +++ b/src/main/java/teetime/framework/AbstractRunnableStage.java @@ -25,7 +25,7 @@ abstract class AbstractRunnableStage implements Runnable { private static final String TERMINATING_THREAD_DUE_TO_THE_FOLLOWING_EXCEPTION = "Terminating thread due to the following exception: "; - private final Stage stage; + protected final Stage stage; @SuppressWarnings("PMD.LoggerIsNotStaticFinal") protected final Logger logger; @@ -39,16 +39,16 @@ abstract class AbstractRunnableStage implements Runnable { this.logger.debug("Executing runnable stage..."); boolean failed = false; try { - beforeStageExecution(stage); + beforeStageExecution(); try { do { - executeStage(stage); + executeStage(); } while (!stage.shouldBeTerminated()); } catch (StageException e) { this.stage.terminate(); failed = true; } - afterStageExecution(stage); + afterStageExecution(); } catch (RuntimeException e) { this.logger.error(TERMINATING_THREAD_DUE_TO_THE_FOLLOWING_EXCEPTION, e); @@ -72,10 +72,10 @@ abstract class AbstractRunnableStage implements Runnable { } - protected abstract void beforeStageExecution(Stage stage) throws InterruptedException; + protected abstract void beforeStageExecution() throws InterruptedException; - protected abstract void executeStage(Stage stage); + protected abstract void executeStage(); - protected abstract void afterStageExecution(Stage stage); + protected abstract void afterStageExecution(); } diff --git a/src/main/java/teetime/framework/RunnableConsumerStage.java b/src/main/java/teetime/framework/RunnableConsumerStage.java index 7a1d071d80c5740ae9653fb04b34b2b0157d99df..c1a78e20917d21a7052dd47f66fd3ed18e3f023b 100644 --- a/src/main/java/teetime/framework/RunnableConsumerStage.java +++ b/src/main/java/teetime/framework/RunnableConsumerStage.java @@ -42,7 +42,7 @@ final class RunnableConsumerStage extends AbstractRunnableStage { @SuppressWarnings("PMD.GuardLogStatement") @Override - protected void beforeStageExecution(final Stage stage) throws InterruptedException { + protected void beforeStageExecution() throws InterruptedException { logger.trace("Waiting for start signals... " + stage); for (InputPort<?> inputPort : inputPorts) { inputPort.waitForInitializingSignal(); @@ -54,7 +54,7 @@ final class RunnableConsumerStage extends AbstractRunnableStage { } @Override - protected void executeStage(final Stage stage) { + protected void executeStage() { try { stage.executeStage(); } catch (NotEnoughInputException e) { @@ -73,7 +73,7 @@ final class RunnableConsumerStage extends AbstractRunnableStage { } @Override - protected void afterStageExecution(final Stage stage) { + protected void afterStageExecution() { final ISignal signal = new TerminatingSignal(); for (InputPort<?> inputPort : inputPorts) { stage.onSignal(signal, inputPort); diff --git a/src/main/java/teetime/framework/RunnableProducerStage.java b/src/main/java/teetime/framework/RunnableProducerStage.java index 2b7b556af36be9f5dd00b4c827c48dea1b831dc5..38a72f462b9c5476f52fcbfa0aef60285fde2d72 100644 --- a/src/main/java/teetime/framework/RunnableProducerStage.java +++ b/src/main/java/teetime/framework/RunnableProducerStage.java @@ -18,27 +18,27 @@ package teetime.framework; import teetime.framework.signal.StartingSignal; import teetime.framework.signal.TerminatingSignal; -public final class RunnableProducerStage extends AbstractRunnableStage { +final class RunnableProducerStage extends AbstractRunnableStage { public RunnableProducerStage(final Stage stage) { super(stage); } @Override - protected void beforeStageExecution(final Stage stage) { + protected void beforeStageExecution() { final StartingSignal startingSignal = new StartingSignal(); - stage.onSignal(startingSignal, null); + this.stage.onSignal(startingSignal, null); } @Override - protected void executeStage(final Stage stage) { - stage.executeStage(); + protected void executeStage() { + this.stage.executeStage(); } @Override - protected void afterStageExecution(final Stage stage) { + protected void afterStageExecution() { final TerminatingSignal terminatingSignal = new TerminatingSignal(); - stage.onSignal(terminatingSignal, null); + this.stage.onSignal(terminatingSignal, null); } }