From 3dd89605016dff624ada949b8e8023cef8a7a604 Mon Sep 17 00:00:00 2001 From: Nelson Tavares de Sousa <stu103017@mail.uni-kiel.de> Date: Mon, 22 Jun 2015 13:42:19 +0200 Subject: [PATCH] added some logger calls for better debugging --- .../teetime/framework/ConfigurationContext.java | 14 ++++++++++++-- .../ExceptionTestConfiguration.java | 3 +-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/java/teetime/framework/ConfigurationContext.java b/src/main/java/teetime/framework/ConfigurationContext.java index 496be307..d6341823 100644 --- a/src/main/java/teetime/framework/ConfigurationContext.java +++ b/src/main/java/teetime/framework/ConfigurationContext.java @@ -18,6 +18,9 @@ package teetime.framework; import java.util.HashSet; import java.util.Set; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import teetime.framework.pipe.IPipe; import teetime.framework.pipe.IPipeFactory; import teetime.framework.pipe.InstantiationPipe; @@ -31,6 +34,8 @@ import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication; */ public abstract class ConfigurationContext extends Configuration { + private static final Logger LOGGER = LoggerFactory.getLogger(ConfigurationContext.class); + private final Set<Stage> threadableStages = new HashSet<Stage>(); @SuppressWarnings("deprecation") @@ -61,7 +66,9 @@ public abstract class ConfigurationContext extends Configuration { */ @Override protected final void addThreadableStage(final Stage stage) { - this.threadableStages.add(stage); + if (this.threadableStages.add(stage)) { + LOGGER.warn("Stage " + stage.getId() + " was already marked as threadable stage."); + } } /** @@ -192,9 +199,12 @@ public abstract class ConfigurationContext extends Configuration { */ @Override protected final <T> void connectPorts(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort, final int capacity) { - if (sourcePort.getOwningStage().getInputPorts().length == 0) { + if (sourcePort.getOwningStage().getInputPorts().length == 0 && !threadableStages.contains(sourcePort.getOwningStage())) { addThreadableStage(sourcePort.getOwningStage()); } + if (sourcePort.pipe != null) { + LOGGER.warn("Overwritting existing pipe connecting stages " + sourcePort.getOwningStage().getId() + " and " + targetPort.getOwningStage().getId() + "."); + } new InstantiationPipe(sourcePort, targetPort, capacity); } diff --git a/src/test/java/teetime/framework/exceptionHandling/ExceptionTestConfiguration.java b/src/test/java/teetime/framework/exceptionHandling/ExceptionTestConfiguration.java index 15b5023b..bf9d3c7a 100644 --- a/src/test/java/teetime/framework/exceptionHandling/ExceptionTestConfiguration.java +++ b/src/test/java/teetime/framework/exceptionHandling/ExceptionTestConfiguration.java @@ -31,8 +31,7 @@ public class ExceptionTestConfiguration extends ConfigurationContext { connectPorts(first.getOutputPort(), second.getInputPort()); // this.addThreadableStage(new ExceptionTestStage()); - this.addThreadableStage(first); this.addThreadableStage(second); - this.addThreadableStage(third); + // this.addThreadableStage(third); } } -- GitLab