Package javaflow.network.impl

Source Code of javaflow.network.impl.ReceiveNonNullPackets

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();

        }
    }
}
TOP

Related Classes of javaflow.network.impl.ReceiveNonNullPackets

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.