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

some renamings

parent 051b6556
No related branches found
No related tags found
No related merge requests found
Showing
with 30 additions and 28 deletions
#FindBugs User Preferences #FindBugs User Preferences
#Fri Dec 19 13:43:52 CET 2014 #Wed Feb 04 14:55:08 CET 2015
detector_threshold=3 detector_threshold=3
effort=max effort=max
excludefilter0=.fbExcludeFilterFile|true excludefilter0=.fbExcludeFilterFile|true
......
...@@ -4,20 +4,21 @@ import org.slf4j.Logger; ...@@ -4,20 +4,21 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import teetime.framework.exceptionHandling.StageException; import teetime.framework.exceptionHandling.StageException;
import teetime.framework.exceptionHandling.StageExceptionListener; import teetime.framework.exceptionHandling.StageExceptionHandler;
import teetime.framework.exceptionHandling.StageExceptionListener.FurtherExecution; import teetime.framework.exceptionHandling.StageExceptionHandler.FurtherExecution;
abstract class RunnableStage implements Runnable { abstract class AbstractRunnableStage implements Runnable {
private final StageExceptionHandler exceptionHandler;
protected final Stage stage; protected final Stage stage;
@SuppressWarnings("PMD.LoggerIsNotStaticFinal") @SuppressWarnings("PMD.LoggerIsNotStaticFinal")
protected final Logger logger; protected final Logger logger;
private final StageExceptionListener listener;
public RunnableStage(final Stage stage, final StageExceptionListener exceptionListener) { public AbstractRunnableStage(final Stage stage, final StageExceptionHandler exceptionHandler) {
this.stage = stage; this.stage = stage;
this.logger = LoggerFactory.getLogger(stage.getClass()); this.logger = LoggerFactory.getLogger(stage.getClass());
this.listener = exceptionListener; this.exceptionHandler = exceptionHandler;
} }
@Override @Override
...@@ -31,7 +32,8 @@ abstract class RunnableStage implements Runnable { ...@@ -31,7 +32,8 @@ abstract class RunnableStage implements Runnable {
try { try {
executeStage(); executeStage();
} catch (StageException e) { } catch (StageException e) {
if (this.listener.onStageException(e, e.getThrowingStage()) == FurtherExecution.TERMINATE) { final FurtherExecution furtherExecution = this.exceptionHandler.onStageException(e, e.getThrowingStage());
if (furtherExecution == FurtherExecution.TERMINATE) {
this.stage.terminate(); this.stage.terminate();
failed = true; failed = true;
} }
......
...@@ -10,7 +10,7 @@ import org.slf4j.Logger; ...@@ -10,7 +10,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import teetime.framework.exceptionHandling.IgnoringStageListener; import teetime.framework.exceptionHandling.IgnoringStageListener;
import teetime.framework.exceptionHandling.StageExceptionListener; import teetime.framework.exceptionHandling.StageExceptionHandler;
import teetime.framework.signal.TerminatingSignal; import teetime.framework.signal.TerminatingSignal;
import teetime.framework.signal.ValidatingSignal; import teetime.framework.signal.ValidatingSignal;
import teetime.framework.validation.AnalysisNotValidException; import teetime.framework.validation.AnalysisNotValidException;
...@@ -29,7 +29,7 @@ public class Analysis implements UncaughtExceptionHandler { ...@@ -29,7 +29,7 @@ public class Analysis implements UncaughtExceptionHandler {
private final AnalysisConfiguration configuration; private final AnalysisConfiguration configuration;
private final StageExceptionListener listener; private final StageExceptionHandler listener;
private boolean executionInterrupted = false; private boolean executionInterrupted = false;
...@@ -61,11 +61,11 @@ public class Analysis implements UncaughtExceptionHandler { ...@@ -61,11 +61,11 @@ public class Analysis implements UncaughtExceptionHandler {
* @param listener * @param listener
* specific listener for the exception handling * specific listener for the exception handling
*/ */
public Analysis(final AnalysisConfiguration configuration, final StageExceptionListener listener) { public Analysis(final AnalysisConfiguration configuration, final StageExceptionHandler listener) {
this(configuration, false, listener); this(configuration, false, listener);
} }
public Analysis(final AnalysisConfiguration configuration, final boolean validationEnabled, final StageExceptionListener listener) { public Analysis(final AnalysisConfiguration configuration, final boolean validationEnabled, final StageExceptionHandler listener) {
this.configuration = configuration; this.configuration = configuration;
this.listener = listener; this.listener = listener;
if (validationEnabled) { if (validationEnabled) {
...@@ -94,7 +94,7 @@ public class Analysis implements UncaughtExceptionHandler { ...@@ -94,7 +94,7 @@ public class Analysis implements UncaughtExceptionHandler {
public void init() { public void init() {
final List<Stage> threadableStageJobs = this.configuration.getThreadableStageJobs(); final List<Stage> threadableStageJobs = this.configuration.getThreadableStageJobs();
for (Stage stage : threadableStageJobs) { for (Stage stage : threadableStageJobs) {
StageExceptionListener newListener; StageExceptionHandler newListener;
try { try {
newListener = listener.getClass().newInstance(); newListener = listener.getClass().newInstance();
} catch (InstantiationException e) { } catch (InstantiationException e) {
......
...@@ -2,13 +2,13 @@ package teetime.framework; ...@@ -2,13 +2,13 @@ package teetime.framework;
import java.util.Arrays; import java.util.Arrays;
import teetime.framework.exceptionHandling.StageExceptionListener; import teetime.framework.exceptionHandling.StageExceptionHandler;
import teetime.framework.idle.IdleStrategy; import teetime.framework.idle.IdleStrategy;
import teetime.framework.idle.YieldStrategy; import teetime.framework.idle.YieldStrategy;
import teetime.framework.pipe.IPipe; import teetime.framework.pipe.IPipe;
import teetime.framework.signal.ISignal; import teetime.framework.signal.ISignal;
final class RunnableConsumerStage extends RunnableStage { final class RunnableConsumerStage extends AbstractRunnableStage {
private final IdleStrategy idleStrategy; private final IdleStrategy idleStrategy;
...@@ -18,11 +18,11 @@ final class RunnableConsumerStage extends RunnableStage { ...@@ -18,11 +18,11 @@ final class RunnableConsumerStage extends RunnableStage {
* @param stage * @param stage
* to execute within an own thread * to execute within an own thread
*/ */
public RunnableConsumerStage(final Stage stage, final StageExceptionListener exceptionListener) { public RunnableConsumerStage(final Stage stage, final StageExceptionHandler exceptionListener) {
this(stage, new YieldStrategy(), exceptionListener); this(stage, new YieldStrategy(), exceptionListener);
} }
public RunnableConsumerStage(final Stage stage, final IdleStrategy idleStrategy, final StageExceptionListener exceptionListener) { public RunnableConsumerStage(final Stage stage, final IdleStrategy idleStrategy, final StageExceptionHandler exceptionListener) {
super(stage, exceptionListener); super(stage, exceptionListener);
this.idleStrategy = idleStrategy; this.idleStrategy = idleStrategy;
} }
......
package teetime.framework; package teetime.framework;
import teetime.framework.exceptionHandling.StageExceptionListener; import teetime.framework.exceptionHandling.StageExceptionHandler;
import teetime.framework.signal.StartingSignal; import teetime.framework.signal.StartingSignal;
import teetime.framework.signal.TerminatingSignal; import teetime.framework.signal.TerminatingSignal;
public final class RunnableProducerStage extends RunnableStage { public final class RunnableProducerStage extends AbstractRunnableStage {
public RunnableProducerStage(final Stage stage, final StageExceptionListener listener) { public RunnableProducerStage(final Stage stage, final StageExceptionHandler listener) {
super(stage, listener); super(stage, listener);
} }
......
...@@ -27,7 +27,7 @@ public abstract class Stage { ...@@ -27,7 +27,7 @@ public abstract class Stage {
@SuppressWarnings("PMD.LoggerIsNotStaticFinal") @SuppressWarnings("PMD.LoggerIsNotStaticFinal")
protected final Logger logger; protected final Logger logger;
/** The owning thread of this stage if this stage is directly executed by a {@link RunnableStage}, <code>null</code> otherwise. */ /** The owning thread of this stage if this stage is directly executed by a {@link AbstractRunnableStage}, <code>null</code> otherwise. */
protected Thread owningThread; protected Thread owningThread;
protected Stage() { protected Stage() {
......
...@@ -2,7 +2,7 @@ package teetime.framework.exceptionHandling; ...@@ -2,7 +2,7 @@ package teetime.framework.exceptionHandling;
import teetime.framework.Stage; import teetime.framework.Stage;
public class IgnoringStageListener extends StageExceptionListener { public class IgnoringStageListener extends StageExceptionHandler {
public IgnoringStageListener() { public IgnoringStageListener() {
super(); super();
......
...@@ -2,7 +2,7 @@ package teetime.framework.exceptionHandling; ...@@ -2,7 +2,7 @@ package teetime.framework.exceptionHandling;
import teetime.framework.Stage; import teetime.framework.Stage;
public class LoggingStageListener extends StageExceptionListener { public class LoggingStageListener extends StageExceptionHandler {
@Override @Override
public FurtherExecution onStageException(final Exception e, final Stage throwingStage) { public FurtherExecution onStageException(final Exception e, final Stage throwingStage) {
......
...@@ -9,7 +9,7 @@ import teetime.framework.Stage; ...@@ -9,7 +9,7 @@ import teetime.framework.Stage;
* Represent a minimalistic StageExceptionListener. Listener which extend from this one, must a least implement this functionality. * Represent a minimalistic StageExceptionListener. Listener which extend from this one, must a least implement this functionality.
* This abstract class provides a Logger {@link #logger} and a method to terminate the threads execution {@link #terminateExecution()}. * This abstract class provides a Logger {@link #logger} and a method to terminate the threads execution {@link #terminateExecution()}.
*/ */
public abstract class StageExceptionListener { public abstract class StageExceptionHandler {
public enum FurtherExecution { public enum FurtherExecution {
CONTINUE, TERMINATE CONTINUE, TERMINATE
...@@ -20,7 +20,7 @@ public abstract class StageExceptionListener { ...@@ -20,7 +20,7 @@ public abstract class StageExceptionListener {
*/ */
protected final Logger logger; protected final Logger logger;
public StageExceptionListener() { public StageExceptionHandler() {
this.logger = LoggerFactory.getLogger(this.getClass().getCanonicalName()); this.logger = LoggerFactory.getLogger(this.getClass().getCanonicalName());
} }
......
...@@ -2,7 +2,7 @@ package teetime.framework.exceptionHandling; ...@@ -2,7 +2,7 @@ package teetime.framework.exceptionHandling;
import teetime.framework.Stage; import teetime.framework.Stage;
public class TerminatingStageListener extends StageExceptionListener { public class TerminatingStageListener extends StageExceptionHandler {
@Override @Override
public FurtherExecution onStageException(final Exception e, final Stage throwingStage) { public FurtherExecution onStageException(final Exception e, final Stage throwingStage) {
......
wiki @ 0e447457
Subproject commit a93581905ef7b0584d52eae1898148ffa6201a31 Subproject commit 0e4474577e1f49bc96e734c286b2d9e0363895e8
...@@ -2,7 +2,7 @@ package teetime.framework.exceptionHandling; ...@@ -2,7 +2,7 @@ package teetime.framework.exceptionHandling;
import teetime.framework.Stage; import teetime.framework.Stage;
public class TestListener extends StageExceptionListener { public class TestListener extends StageExceptionHandler {
public static int exceptionInvoked = 0; public static int exceptionInvoked = 0;
......
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