Skip to content
Snippets Groups Projects
Commit d95e71a1 authored by Nelson Tavares de Sousa's avatar Nelson Tavares de Sousa
Browse files

removed arguments and changed visibility

parent 1c315ed8
No related branches found
No related tags found
No related merge requests found
......@@ -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();
}
......@@ -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);
......
......@@ -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);
}
}
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