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

added some logger calls for better debugging

parent 52e14f16
No related branches found
No related tags found
No related merge requests found
...@@ -18,6 +18,9 @@ package teetime.framework; ...@@ -18,6 +18,9 @@ package teetime.framework;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import teetime.framework.pipe.IPipe; import teetime.framework.pipe.IPipe;
import teetime.framework.pipe.IPipeFactory; import teetime.framework.pipe.IPipeFactory;
import teetime.framework.pipe.InstantiationPipe; import teetime.framework.pipe.InstantiationPipe;
...@@ -31,6 +34,8 @@ import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication; ...@@ -31,6 +34,8 @@ import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication;
*/ */
public abstract class ConfigurationContext extends Configuration { public abstract class ConfigurationContext extends Configuration {
private static final Logger LOGGER = LoggerFactory.getLogger(ConfigurationContext.class);
private final Set<Stage> threadableStages = new HashSet<Stage>(); private final Set<Stage> threadableStages = new HashSet<Stage>();
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
...@@ -61,7 +66,9 @@ public abstract class ConfigurationContext extends Configuration { ...@@ -61,7 +66,9 @@ public abstract class ConfigurationContext extends Configuration {
*/ */
@Override @Override
protected final void addThreadableStage(final Stage stage) { 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 { ...@@ -192,9 +199,12 @@ public abstract class ConfigurationContext extends Configuration {
*/ */
@Override @Override
protected final <T> void connectPorts(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort, final int capacity) { 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()); 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); new InstantiationPipe(sourcePort, targetPort, capacity);
} }
......
...@@ -31,8 +31,7 @@ public class ExceptionTestConfiguration extends ConfigurationContext { ...@@ -31,8 +31,7 @@ public class ExceptionTestConfiguration extends ConfigurationContext {
connectPorts(first.getOutputPort(), second.getInputPort()); connectPorts(first.getOutputPort(), second.getInputPort());
// this.addThreadableStage(new ExceptionTestStage()); // this.addThreadableStage(new ExceptionTestStage());
this.addThreadableStage(first);
this.addThreadableStage(second); this.addThreadableStage(second);
this.addThreadableStage(third); // this.addThreadableStage(third);
} }
} }
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