package javaflow.network.impl;
import javaflow.components.api.Packet;
class RunnableSubstreamSensitiveSubnetOutput extends RunnableSubnetOutput {
public RunnableSubstreamSensitiveSubnetOutput(
String port, InputPortImpl inputPort, OutputPortImpl outputPort,
SubnetComponent subnetComponent) {
super(port,inputPort, outputPort, subnetComponent);
}
@Override
protected boolean shouldContinueRunning() {
return false;
}
@Override
public void execute() {
Packet packet;
boolean firstPacket = true;
while((packet = inputPort.receive())!=null){
if (firstPacket){
firstPacket = false;
outputPort.createPacket(null).beStart().send();
}
outputPort.send(packet);
}
outputPort.createPacket(null).beEnd().send();
}
}