use of com.datatorrent.stram.debug.MuxSink in project apex-core by apache.
the class Node method addSinks.
@SuppressWarnings({ "unchecked" })
public void addSinks(Map<String, Sink<Object>> sinks) {
boolean changes = false;
for (Entry<String, Sink<Object>> e : sinks.entrySet()) {
/* make sure that we ignore all the input ports */
PortContextPair<OutputPort<?>> pcpair = descriptor.outputPorts.get(e.getKey());
if (pcpair == null) {
continue;
}
changes = true;
Sink<Object> ics = outputs.get(e.getKey());
if (ics == null) {
pcpair.component.setSink(e.getValue());
outputs.put(e.getKey(), e.getValue());
changes = true;
} else if (ics instanceof MuxSink) {
((MuxSink) ics).add(e.getValue());
} else {
MuxSink muxSink = new MuxSink(ics, e.getValue());
pcpair.component.setSink(muxSink);
outputs.put(e.getKey(), muxSink);
changes = true;
}
}
if (changes) {
activateSinks();
}
}
Aggregations