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

made ports final, again;

added logging to A3PipeInstantiation
parent 43f27c9d
Branches
Tags
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.Traverser.VisitorBehavior; import teetime.framework.Traverser.VisitorBehavior;
import teetime.framework.pipe.IPipe; import teetime.framework.pipe.IPipe;
import teetime.framework.pipe.IPipeFactory; import teetime.framework.pipe.IPipeFactory;
...@@ -31,6 +34,8 @@ import teetime.framework.pipe.UnboundedSpScPipeFactory; ...@@ -31,6 +34,8 @@ import teetime.framework.pipe.UnboundedSpScPipeFactory;
*/ */
class A3PipeInstantiation implements ITraverserVisitor { class A3PipeInstantiation implements ITraverserVisitor {
private static final Logger LOGGER = LoggerFactory.getLogger(A3PipeInstantiation.class);
private static final IPipeFactory interBoundedThreadPipeFactory = new SpScPipeFactory(); private static final IPipeFactory interBoundedThreadPipeFactory = new SpScPipeFactory();
private static final IPipeFactory interUnboundedThreadPipeFactory = new UnboundedSpScPipeFactory(); private static final IPipeFactory interUnboundedThreadPipeFactory = new UnboundedSpScPipeFactory();
private static final IPipeFactory intraThreadPipeFactory = new SingleElementPipeFactory(); private static final IPipeFactory intraThreadPipeFactory = new SingleElementPipeFactory();
...@@ -67,14 +72,22 @@ class A3PipeInstantiation implements ITraverserVisitor { ...@@ -67,14 +72,22 @@ class A3PipeInstantiation implements ITraverserVisitor {
// inter // inter
if (pipe.capacity() != 0) { if (pipe.capacity() != 0) {
interBoundedThreadPipeFactory.create(pipe.getSourcePort(), pipe.getTargetPort(), pipe.capacity()); interBoundedThreadPipeFactory.create(pipe.getSourcePort(), pipe.getTargetPort(), pipe.capacity());
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Connected (bounded) " + pipe.getSourcePort() + " and " + pipe.getTargetPort());
}
} else { } else {
interUnboundedThreadPipeFactory.create(pipe.getSourcePort(), pipe.getTargetPort(), 4); interUnboundedThreadPipeFactory.create(pipe.getSourcePort(), pipe.getTargetPort(), 4);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Connected (unbounded) " + pipe.getSourcePort() + " and " + pipe.getTargetPort());
}
} }
} else { } else {
// normal or reflexive pipe => intra // normal or reflexive pipe => intra
intraThreadPipeFactory.create(pipe.getSourcePort(), pipe.getTargetPort(), 4); intraThreadPipeFactory.create(pipe.getSourcePort(), pipe.getTargetPort(), 4);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Connected (unsynch) " + pipe.getSourcePort() + " and " + pipe.getTargetPort());
} }
} }
} }
}
...@@ -91,8 +91,10 @@ public abstract class AbstractStage extends Stage { ...@@ -91,8 +91,10 @@ public abstract class AbstractStage extends Stage {
private void changeState(final StageState newState) { private void changeState(final StageState newState) {
currentState = newState; currentState = newState;
if (logger.isTraceEnabled()) {
logger.trace(newState.toString()); logger.trace(newState.toString());
} }
}
@Override @Override
public void onValidating(final List<InvalidPortConnection> invalidPortConnections) { public void onValidating(final List<InvalidPortConnection> invalidPortConnections) {
......
...@@ -24,7 +24,7 @@ package teetime.framework; ...@@ -24,7 +24,7 @@ package teetime.framework;
* *
* @since 1.0 * @since 1.0
*/ */
public class InputPort<T> extends AbstractPort<T> { public final class InputPort<T> extends AbstractPort<T> {
InputPort(final Class<T> type, final Stage owningStage, final String portName) { InputPort(final Class<T> type, final Stage owningStage, final String portName) {
super(type, owningStage, portName); super(type, owningStage, portName);
......
...@@ -28,7 +28,7 @@ import teetime.framework.signal.TerminatingSignal; ...@@ -28,7 +28,7 @@ import teetime.framework.signal.TerminatingSignal;
* *
* @since 1.0 * @since 1.0
*/ */
public class OutputPort<T> extends AbstractPort<T> { public final class OutputPort<T> extends AbstractPort<T> {
OutputPort(final Class<T> type, final Stage owningStage, final String portName) { OutputPort(final Class<T> type, final Stage owningStage, final String portName) {
super(type, owningStage, portName); super(type, owningStage, portName);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment