package javaflow.network.impl;
import javaflow.components.api.Component;
import javaflow.components.api.InputPort;
import javaflow.components.api.OutputPort;
import javaflow.components.api.Packet;
public class ReceiveNonNullPackets implements Component {
InputPort in;
OutputPort error;
@Override
public void execute() {
Packet p = in.receive();
if (p == null) {
// This should never happend because component should not be started without
// having an actual packet in one of its input ports.
error.createPacket("NOOO, IT WAS NULL.").send();
} else {
p.drop();
}
}
}