From 537ad05c19370b4bad3844bdcf534e82495b903b Mon Sep 17 00:00:00 2001 From: Nelson Tavares de Sousa <ntd@informatik.uni-kiel.de> Date: Fri, 27 Mar 2015 13:53:59 +0100 Subject: [PATCH] instatiating the listener is now handled by a factory; renamed classes --- .../framework/AbstractRunnableStage.java | 8 ++--- src/main/java/teetime/framework/Analysis.java | 31 ++++++++----------- .../framework/RunnableConsumerStage.java | 6 ++-- .../framework/RunnableProducerStage.java | 4 +-- ...er.java => AbstractExceptionListener.java} | 4 +-- .../IExceptionListenerFactory.java | 7 +++++ ...er.java => IgnoringExceptionListener.java} | 4 +-- .../IgnoringExceptionListenerFactory.java | 10 ++++++ .../LoggingExceptionListenerFactory.java | 10 ++++++ ... => LoggingExceptionListenerListener.java} | 2 +- ...java => TerminatingExceptionListener.java} | 2 +- .../TerminatingExceptionListenerFactory.java | 10 ++++++ .../MethodCallThroughputAnalysis9.java | 4 +-- .../MethodCallThroughputAnalysis11.java | 4 +-- .../MethodCallThroughputAnalysis15.java | 6 ++-- .../ExceptionHandling.java | 8 ++--- .../ExceptionTestConfiguration.java | 3 +- .../ExceptionTestConsumerStage.java | 4 ++- .../ExceptionTestProducerStage.java | 6 +++- .../exceptionHandling/TestListener.java | 2 +- .../TestListenerFactory.java | 10 ++++++ 21 files changed, 96 insertions(+), 49 deletions(-) rename src/main/java/teetime/framework/exceptionHandling/{AbstractStageExceptionHandler.java => AbstractExceptionListener.java} (91%) create mode 100644 src/main/java/teetime/framework/exceptionHandling/IExceptionListenerFactory.java rename src/main/java/teetime/framework/exceptionHandling/{IgnoringStageListener.java => IgnoringExceptionListener.java} (67%) create mode 100644 src/main/java/teetime/framework/exceptionHandling/IgnoringExceptionListenerFactory.java create mode 100644 src/main/java/teetime/framework/exceptionHandling/LoggingExceptionListenerFactory.java rename src/main/java/teetime/framework/exceptionHandling/{LoggingStageListener.java => LoggingExceptionListenerListener.java} (77%) rename src/main/java/teetime/framework/exceptionHandling/{TerminatingStageListener.java => TerminatingExceptionListener.java} (78%) create mode 100644 src/main/java/teetime/framework/exceptionHandling/TerminatingExceptionListenerFactory.java rename src/test/java/teetime/framework/{ => exceptionHandling}/ExceptionHandling.java (73%) rename src/test/java/teetime/framework/{ => exceptionHandling}/ExceptionTestConfiguration.java (89%) rename src/test/java/teetime/framework/{ => exceptionHandling}/ExceptionTestConsumerStage.java (76%) rename src/test/java/teetime/framework/{ => exceptionHandling}/ExceptionTestProducerStage.java (82%) create mode 100644 src/test/java/teetime/framework/exceptionHandling/TestListenerFactory.java diff --git a/src/main/java/teetime/framework/AbstractRunnableStage.java b/src/main/java/teetime/framework/AbstractRunnableStage.java index 8b20fa8c..35f41f13 100644 --- a/src/main/java/teetime/framework/AbstractRunnableStage.java +++ b/src/main/java/teetime/framework/AbstractRunnableStage.java @@ -4,13 +4,13 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import teetime.framework.exceptionHandling.StageException; -import teetime.framework.exceptionHandling.AbstractStageExceptionHandler; -import teetime.framework.exceptionHandling.AbstractStageExceptionHandler.FurtherExecution; +import teetime.framework.exceptionHandling.AbstractExceptionListener; +import teetime.framework.exceptionHandling.AbstractExceptionListener.FurtherExecution; import teetime.framework.signal.TerminatingSignal; abstract class AbstractRunnableStage implements Runnable { - private final AbstractStageExceptionHandler exceptionHandler; + private final AbstractExceptionListener exceptionHandler; private static final String TERMINATING_THREAD_DUE_TO_THE_FOLLOWING_EXCEPTION = "Terminating thread due to the following exception: "; @@ -18,7 +18,7 @@ abstract class AbstractRunnableStage implements Runnable { @SuppressWarnings("PMD.LoggerIsNotStaticFinal") protected final Logger logger; - public AbstractRunnableStage(final Stage stage, final AbstractStageExceptionHandler exceptionHandler) { + public AbstractRunnableStage(final Stage stage, final AbstractExceptionListener exceptionHandler) { this.stage = stage; this.logger = LoggerFactory.getLogger(stage.getClass()); this.exceptionHandler = exceptionHandler; diff --git a/src/main/java/teetime/framework/Analysis.java b/src/main/java/teetime/framework/Analysis.java index 9238dce9..01cefe37 100644 --- a/src/main/java/teetime/framework/Analysis.java +++ b/src/main/java/teetime/framework/Analysis.java @@ -24,8 +24,9 @@ import java.util.concurrent.ConcurrentLinkedQueue; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import teetime.framework.exceptionHandling.IgnoringStageListener; -import teetime.framework.exceptionHandling.AbstractStageExceptionHandler; +import teetime.framework.exceptionHandling.AbstractExceptionListener; +import teetime.framework.exceptionHandling.IExceptionListenerFactory; +import teetime.framework.exceptionHandling.IgnoringExceptionListenerFactory; import teetime.framework.signal.ValidatingSignal; import teetime.framework.validation.AnalysisNotValidException; import teetime.util.Pair; @@ -43,7 +44,7 @@ public final class Analysis implements UncaughtExceptionHandler { private final AnalysisConfiguration configuration; - private final Class<? extends teetime.framework.exceptionHandling.AbstractStageExceptionHandler> listener; + private final IExceptionListenerFactory factory; private boolean executionInterrupted = false; @@ -62,13 +63,13 @@ public final class Analysis implements UncaughtExceptionHandler { * to be used for the analysis */ public Analysis(final AnalysisConfiguration configuration) { - this(configuration, false, IgnoringStageListener.class); + this(configuration, false, new IgnoringExceptionListenerFactory()); } @SuppressWarnings("PMD.ConstructorCallsOverridableMethod") // TODO remove @SuppressWarnings if init is no longer deprecated public Analysis(final AnalysisConfiguration configuration, final boolean validationEnabled) { - this(configuration, validationEnabled, IgnoringStageListener.class); + this(configuration, validationEnabled, new IgnoringExceptionListenerFactory()); } /** @@ -76,16 +77,16 @@ public final class Analysis implements UncaughtExceptionHandler { * * @param configuration * to be used for the analysis - * @param listener + * @param factory * specific listener for the exception handling */ - public Analysis(final AnalysisConfiguration configuration, final Class<? extends AbstractStageExceptionHandler> listener) { - this(configuration, false, listener); + public Analysis(final AnalysisConfiguration configuration, final IExceptionListenerFactory factory) { + this(configuration, false, factory); } - public Analysis(final AnalysisConfiguration configuration, final boolean validationEnabled, final Class<? extends AbstractStageExceptionHandler> listener) { + public Analysis(final AnalysisConfiguration configuration, final boolean validationEnabled, final IExceptionListenerFactory factory) { this.configuration = configuration; - this.listener = listener; + this.factory = factory; if (validationEnabled) { validateStages(); } @@ -124,14 +125,8 @@ public final class Analysis implements UncaughtExceptionHandler { throw new IllegalStateException("No stage was added using the addThreadableStage(..) method. Add at least one stage."); } for (Stage stage : threadableStageJobs) { - AbstractStageExceptionHandler newListener; - try { - newListener = listener.newInstance(); - } catch (InstantiationException e) { - throw new IllegalStateException(e); - } catch (IllegalAccessException e) { - throw new IllegalStateException(e); - } + AbstractExceptionListener newListener; + newListener = factory.newHandlerInstance(); switch (stage.getTerminationStrategy()) { case BY_SIGNAL: { final Thread thread = new Thread(new RunnableConsumerStage(stage, newListener)); diff --git a/src/main/java/teetime/framework/RunnableConsumerStage.java b/src/main/java/teetime/framework/RunnableConsumerStage.java index 9c37dde7..92ed61e4 100644 --- a/src/main/java/teetime/framework/RunnableConsumerStage.java +++ b/src/main/java/teetime/framework/RunnableConsumerStage.java @@ -15,7 +15,7 @@ */ package teetime.framework; -import teetime.framework.exceptionHandling.AbstractStageExceptionHandler; +import teetime.framework.exceptionHandling.AbstractExceptionListener; import teetime.framework.idle.IdleStrategy; import teetime.framework.idle.YieldStrategy; import teetime.framework.signal.ISignal; @@ -32,11 +32,11 @@ final class RunnableConsumerStage extends AbstractRunnableStage { * @param stage * to execute within an own thread */ - public RunnableConsumerStage(final Stage stage, final AbstractStageExceptionHandler exceptionListener) { + public RunnableConsumerStage(final Stage stage, final AbstractExceptionListener exceptionListener) { this(stage, new YieldStrategy(), exceptionListener); } - public RunnableConsumerStage(final Stage stage, final IdleStrategy idleStrategy, final AbstractStageExceptionHandler exceptionListener) { + public RunnableConsumerStage(final Stage stage, final IdleStrategy idleStrategy, final AbstractExceptionListener exceptionListener) { super(stage, exceptionListener); this.inputPorts = stage.getInputPorts(); // FIXME should getInputPorts() really be defined in Stage? } diff --git a/src/main/java/teetime/framework/RunnableProducerStage.java b/src/main/java/teetime/framework/RunnableProducerStage.java index fc4c8a54..adda02b6 100644 --- a/src/main/java/teetime/framework/RunnableProducerStage.java +++ b/src/main/java/teetime/framework/RunnableProducerStage.java @@ -15,13 +15,13 @@ */ package teetime.framework; -import teetime.framework.exceptionHandling.AbstractStageExceptionHandler; +import teetime.framework.exceptionHandling.AbstractExceptionListener; import teetime.framework.signal.StartingSignal; import teetime.framework.signal.TerminatingSignal; public final class RunnableProducerStage extends AbstractRunnableStage { - public RunnableProducerStage(final Stage stage, final AbstractStageExceptionHandler listener) { + public RunnableProducerStage(final Stage stage, final AbstractExceptionListener listener) { super(stage, listener); } diff --git a/src/main/java/teetime/framework/exceptionHandling/AbstractStageExceptionHandler.java b/src/main/java/teetime/framework/exceptionHandling/AbstractExceptionListener.java similarity index 91% rename from src/main/java/teetime/framework/exceptionHandling/AbstractStageExceptionHandler.java rename to src/main/java/teetime/framework/exceptionHandling/AbstractExceptionListener.java index eac052e8..990c58e9 100644 --- a/src/main/java/teetime/framework/exceptionHandling/AbstractStageExceptionHandler.java +++ b/src/main/java/teetime/framework/exceptionHandling/AbstractExceptionListener.java @@ -9,7 +9,7 @@ import teetime.framework.Stage; * 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()}. */ -public abstract class AbstractStageExceptionHandler { +public abstract class AbstractExceptionListener { public enum FurtherExecution { CONTINUE, TERMINATE @@ -20,7 +20,7 @@ public abstract class AbstractStageExceptionHandler { */ protected final Logger logger; - public AbstractStageExceptionHandler() { + public AbstractExceptionListener() { this.logger = LoggerFactory.getLogger(this.getClass().getCanonicalName()); } diff --git a/src/main/java/teetime/framework/exceptionHandling/IExceptionListenerFactory.java b/src/main/java/teetime/framework/exceptionHandling/IExceptionListenerFactory.java new file mode 100644 index 00000000..56e93d4f --- /dev/null +++ b/src/main/java/teetime/framework/exceptionHandling/IExceptionListenerFactory.java @@ -0,0 +1,7 @@ +package teetime.framework.exceptionHandling; + +public interface IExceptionListenerFactory { + + public AbstractExceptionListener newHandlerInstance(); + +} diff --git a/src/main/java/teetime/framework/exceptionHandling/IgnoringStageListener.java b/src/main/java/teetime/framework/exceptionHandling/IgnoringExceptionListener.java similarity index 67% rename from src/main/java/teetime/framework/exceptionHandling/IgnoringStageListener.java rename to src/main/java/teetime/framework/exceptionHandling/IgnoringExceptionListener.java index a815fa2a..f64d828a 100644 --- a/src/main/java/teetime/framework/exceptionHandling/IgnoringStageListener.java +++ b/src/main/java/teetime/framework/exceptionHandling/IgnoringExceptionListener.java @@ -2,9 +2,9 @@ package teetime.framework.exceptionHandling; import teetime.framework.Stage; -public class IgnoringStageListener extends AbstractStageExceptionHandler { +public class IgnoringExceptionListener extends AbstractExceptionListener { - public IgnoringStageListener() { + public IgnoringExceptionListener() { super(); } diff --git a/src/main/java/teetime/framework/exceptionHandling/IgnoringExceptionListenerFactory.java b/src/main/java/teetime/framework/exceptionHandling/IgnoringExceptionListenerFactory.java new file mode 100644 index 00000000..9d3423b2 --- /dev/null +++ b/src/main/java/teetime/framework/exceptionHandling/IgnoringExceptionListenerFactory.java @@ -0,0 +1,10 @@ +package teetime.framework.exceptionHandling; + +public class IgnoringExceptionListenerFactory implements IExceptionListenerFactory { + + @Override + public AbstractExceptionListener newHandlerInstance() { + return new IgnoringExceptionListener(); + } + +} diff --git a/src/main/java/teetime/framework/exceptionHandling/LoggingExceptionListenerFactory.java b/src/main/java/teetime/framework/exceptionHandling/LoggingExceptionListenerFactory.java new file mode 100644 index 00000000..5bac663e --- /dev/null +++ b/src/main/java/teetime/framework/exceptionHandling/LoggingExceptionListenerFactory.java @@ -0,0 +1,10 @@ +package teetime.framework.exceptionHandling; + +public class LoggingExceptionListenerFactory implements IExceptionListenerFactory { + + @Override + public AbstractExceptionListener newHandlerInstance() { + return new LoggingExceptionListenerListener(); + } + +} diff --git a/src/main/java/teetime/framework/exceptionHandling/LoggingStageListener.java b/src/main/java/teetime/framework/exceptionHandling/LoggingExceptionListenerListener.java similarity index 77% rename from src/main/java/teetime/framework/exceptionHandling/LoggingStageListener.java rename to src/main/java/teetime/framework/exceptionHandling/LoggingExceptionListenerListener.java index 8df9fc45..2cdd03d5 100644 --- a/src/main/java/teetime/framework/exceptionHandling/LoggingStageListener.java +++ b/src/main/java/teetime/framework/exceptionHandling/LoggingExceptionListenerListener.java @@ -2,7 +2,7 @@ package teetime.framework.exceptionHandling; import teetime.framework.Stage; -public class LoggingStageListener extends AbstractStageExceptionHandler { +public class LoggingExceptionListenerListener extends AbstractExceptionListener { @Override public FurtherExecution onStageException(final Exception e, final Stage throwingStage) { diff --git a/src/main/java/teetime/framework/exceptionHandling/TerminatingStageListener.java b/src/main/java/teetime/framework/exceptionHandling/TerminatingExceptionListener.java similarity index 78% rename from src/main/java/teetime/framework/exceptionHandling/TerminatingStageListener.java rename to src/main/java/teetime/framework/exceptionHandling/TerminatingExceptionListener.java index 020e7fbe..14a3f9d7 100644 --- a/src/main/java/teetime/framework/exceptionHandling/TerminatingStageListener.java +++ b/src/main/java/teetime/framework/exceptionHandling/TerminatingExceptionListener.java @@ -2,7 +2,7 @@ package teetime.framework.exceptionHandling; import teetime.framework.Stage; -public class TerminatingStageListener extends AbstractStageExceptionHandler { +public class TerminatingExceptionListener extends AbstractExceptionListener { @Override public FurtherExecution onStageException(final Exception e, final Stage throwingStage) { diff --git a/src/main/java/teetime/framework/exceptionHandling/TerminatingExceptionListenerFactory.java b/src/main/java/teetime/framework/exceptionHandling/TerminatingExceptionListenerFactory.java new file mode 100644 index 00000000..49822c17 --- /dev/null +++ b/src/main/java/teetime/framework/exceptionHandling/TerminatingExceptionListenerFactory.java @@ -0,0 +1,10 @@ +package teetime.framework.exceptionHandling; + +public class TerminatingExceptionListenerFactory implements IExceptionListenerFactory { + + @Override + public AbstractExceptionListener newHandlerInstance() { + return new TerminatingExceptionListener(); + } + +} diff --git a/src/performancetest/java/teetime/examples/experiment09pipeimpls/MethodCallThroughputAnalysis9.java b/src/performancetest/java/teetime/examples/experiment09pipeimpls/MethodCallThroughputAnalysis9.java index 6bfaad61..43260a7b 100644 --- a/src/performancetest/java/teetime/examples/experiment09pipeimpls/MethodCallThroughputAnalysis9.java +++ b/src/performancetest/java/teetime/examples/experiment09pipeimpls/MethodCallThroughputAnalysis9.java @@ -20,7 +20,7 @@ import java.util.List; import teetime.framework.OldHeadPipeline; import teetime.framework.RunnableProducerStage; import teetime.framework.Stage; -import teetime.framework.exceptionHandling.IgnoringStageListener; +import teetime.framework.exceptionHandling.IgnoringExceptionListener; import teetime.framework.pipe.IPipeFactory; import teetime.stage.CollectorSink; import teetime.stage.NoopFilter; @@ -45,7 +45,7 @@ public class MethodCallThroughputAnalysis9 { public void init(final IPipeFactory pipeFactory) { Stage pipeline = this.buildPipeline(pipeFactory); - this.runnable = new RunnableProducerStage(pipeline, new IgnoringStageListener()); + this.runnable = new RunnableProducerStage(pipeline, new IgnoringExceptionListener()); } /** diff --git a/src/performancetest/java/teetime/examples/experiment11/MethodCallThroughputAnalysis11.java b/src/performancetest/java/teetime/examples/experiment11/MethodCallThroughputAnalysis11.java index 1c14ea89..60926b61 100644 --- a/src/performancetest/java/teetime/examples/experiment11/MethodCallThroughputAnalysis11.java +++ b/src/performancetest/java/teetime/examples/experiment11/MethodCallThroughputAnalysis11.java @@ -20,7 +20,7 @@ import java.util.List; import teetime.framework.OldHeadPipeline; import teetime.framework.RunnableProducerStage; import teetime.framework.Stage; -import teetime.framework.exceptionHandling.IgnoringStageListener; +import teetime.framework.exceptionHandling.IgnoringExceptionListener; import teetime.framework.pipe.UnorderedGrowablePipe; import teetime.stage.CollectorSink; import teetime.stage.NoopFilter; @@ -45,7 +45,7 @@ public class MethodCallThroughputAnalysis11 { public void init() { Stage pipeline = this.buildPipeline(this.numInputObjects, this.inputObjectCreator); - this.runnable = new RunnableProducerStage(pipeline, new IgnoringStageListener()); + this.runnable = new RunnableProducerStage(pipeline, new IgnoringExceptionListener()); } private OldHeadPipeline<ObjectProducer<TimestampObject>, CollectorSink<TimestampObject>> buildPipeline(final long numInputObjects, diff --git a/src/performancetest/java/teetime/examples/experiment15/MethodCallThroughputAnalysis15.java b/src/performancetest/java/teetime/examples/experiment15/MethodCallThroughputAnalysis15.java index e276da60..2182aa24 100644 --- a/src/performancetest/java/teetime/examples/experiment15/MethodCallThroughputAnalysis15.java +++ b/src/performancetest/java/teetime/examples/experiment15/MethodCallThroughputAnalysis15.java @@ -21,7 +21,7 @@ import teetime.framework.AnalysisConfiguration; import teetime.framework.OldHeadPipeline; import teetime.framework.RunnableProducerStage; import teetime.framework.Stage; -import teetime.framework.exceptionHandling.IgnoringStageListener; +import teetime.framework.exceptionHandling.IgnoringExceptionListener; import teetime.framework.pipe.IPipeFactory; import teetime.framework.pipe.OrderedGrowableArrayPipe; import teetime.framework.pipe.PipeFactoryRegistry.PipeOrdering; @@ -65,10 +65,10 @@ public class MethodCallThroughputAnalysis15 extends AnalysisConfiguration { public void init() { OldHeadPipeline<Clock, Sink<Long>> clockPipeline = this.buildClockPipeline(); - this.clockRunnable = new RunnableProducerStage(clockPipeline, new IgnoringStageListener()); + this.clockRunnable = new RunnableProducerStage(clockPipeline, new IgnoringExceptionListener()); Stage pipeline = this.buildPipeline(this.clock); - this.runnable = new RunnableProducerStage(pipeline, new IgnoringStageListener()); + this.runnable = new RunnableProducerStage(pipeline, new IgnoringExceptionListener()); } private OldHeadPipeline<Clock, Sink<Long>> buildClockPipeline() { diff --git a/src/test/java/teetime/framework/ExceptionHandling.java b/src/test/java/teetime/framework/exceptionHandling/ExceptionHandling.java similarity index 73% rename from src/test/java/teetime/framework/ExceptionHandling.java rename to src/test/java/teetime/framework/exceptionHandling/ExceptionHandling.java index 8e4681cb..a13865c8 100644 --- a/src/test/java/teetime/framework/ExceptionHandling.java +++ b/src/test/java/teetime/framework/exceptionHandling/ExceptionHandling.java @@ -1,4 +1,4 @@ -package teetime.framework; +package teetime.framework.exceptionHandling; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -6,17 +6,15 @@ import static org.junit.Assert.assertTrue; import org.junit.Before; import org.junit.Test; -import teetime.framework.exceptionHandling.TestListener; +import teetime.framework.Analysis; public class ExceptionHandling { - private Class<TestListener> listener; private Analysis analysis; @Before public void newInstances() { - listener = TestListener.class; - analysis = new Analysis(new ExceptionTestConfiguration(), listener); + analysis = new Analysis(new ExceptionTestConfiguration(), new TestListenerFactory()); } @Test(timeout = 5000, expected = RuntimeException.class) diff --git a/src/test/java/teetime/framework/ExceptionTestConfiguration.java b/src/test/java/teetime/framework/exceptionHandling/ExceptionTestConfiguration.java similarity index 89% rename from src/test/java/teetime/framework/ExceptionTestConfiguration.java rename to src/test/java/teetime/framework/exceptionHandling/ExceptionTestConfiguration.java index f7f2a76c..64a742a2 100644 --- a/src/test/java/teetime/framework/ExceptionTestConfiguration.java +++ b/src/test/java/teetime/framework/exceptionHandling/ExceptionTestConfiguration.java @@ -1,5 +1,6 @@ -package teetime.framework; +package teetime.framework.exceptionHandling; +import teetime.framework.AnalysisConfiguration; import teetime.framework.pipe.PipeFactoryRegistry.PipeOrdering; import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication; diff --git a/src/test/java/teetime/framework/ExceptionTestConsumerStage.java b/src/test/java/teetime/framework/exceptionHandling/ExceptionTestConsumerStage.java similarity index 76% rename from src/test/java/teetime/framework/ExceptionTestConsumerStage.java rename to src/test/java/teetime/framework/exceptionHandling/ExceptionTestConsumerStage.java index 034055fd..05f84fde 100644 --- a/src/test/java/teetime/framework/ExceptionTestConsumerStage.java +++ b/src/test/java/teetime/framework/exceptionHandling/ExceptionTestConsumerStage.java @@ -1,4 +1,6 @@ -package teetime.framework; +package teetime.framework.exceptionHandling; + +import teetime.framework.AbstractConsumerStage; public class ExceptionTestConsumerStage extends AbstractConsumerStage<Object> { diff --git a/src/test/java/teetime/framework/ExceptionTestProducerStage.java b/src/test/java/teetime/framework/exceptionHandling/ExceptionTestProducerStage.java similarity index 82% rename from src/test/java/teetime/framework/ExceptionTestProducerStage.java rename to src/test/java/teetime/framework/exceptionHandling/ExceptionTestProducerStage.java index 02c0a086..637143ed 100644 --- a/src/test/java/teetime/framework/ExceptionTestProducerStage.java +++ b/src/test/java/teetime/framework/exceptionHandling/ExceptionTestProducerStage.java @@ -1,4 +1,8 @@ -package teetime.framework; +package teetime.framework.exceptionHandling; + +import teetime.framework.AbstractProducerStage; +import teetime.framework.InputPort; +import teetime.framework.TerminationStrategy; public class ExceptionTestProducerStage extends AbstractProducerStage<Object> { diff --git a/src/test/java/teetime/framework/exceptionHandling/TestListener.java b/src/test/java/teetime/framework/exceptionHandling/TestListener.java index 809fbd5f..9638e84d 100644 --- a/src/test/java/teetime/framework/exceptionHandling/TestListener.java +++ b/src/test/java/teetime/framework/exceptionHandling/TestListener.java @@ -2,7 +2,7 @@ package teetime.framework.exceptionHandling; import teetime.framework.Stage; -public class TestListener extends AbstractStageExceptionHandler { +public class TestListener extends AbstractExceptionListener { public static int exceptionInvoked = 0; diff --git a/src/test/java/teetime/framework/exceptionHandling/TestListenerFactory.java b/src/test/java/teetime/framework/exceptionHandling/TestListenerFactory.java new file mode 100644 index 00000000..ae3785d9 --- /dev/null +++ b/src/test/java/teetime/framework/exceptionHandling/TestListenerFactory.java @@ -0,0 +1,10 @@ +package teetime.framework.exceptionHandling; + +public class TestListenerFactory implements IExceptionListenerFactory { + + @Override + public AbstractExceptionListener newHandlerInstance() { + return new TestListener(); + } + +} -- GitLab