Package javaflow.network.impl

Source Code of javaflow.network.impl.RunnableSubstreamSensitiveSubnetOutput

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

}
TOP

Related Classes of javaflow.network.impl.RunnableSubstreamSensitiveSubnetOutput

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.