Class InputConnectionHandler

    • Field Detail

      • rseqno

        protected int rseqno
        The last in order received sequence number.
      • maxseqno

        protected int maxseqno
        The highest yet (may be out of order) received sequence number.
      • maxackseqno

        protected int maxackseqno
        The highest yet (may be out of order) acknowledged sequence number (only used to trigger new acks every x messages).
      • maxbuf

        protected int maxbuf
        The maximum buffer size for out of order packets.
      • maxstored

        protected int maxstored
        The maximum bytes of data that can be stored in connection (without being consumed).
      • data

        protected java.util.Map<java.lang.Integer,​Tuple2<byte[],​java.lang.Boolean>> data
        The data (stored here only as long as it is out of order or incomplete). Ready data will be forwarded to the connection. Also remembers if an acknowledgement has been sent.
      • lastack

        protected int lastack
        The last in order sequence number acknowledged.
      • ackcnt

        protected int ackcnt
        The number of received elements after which an ack is sent.
      • datatimer

        protected java.util.TimerTask datatimer
        The current timer.
      • lastseqno

        protected int lastseqno
        The last sequence number.
    • Constructor Detail

      • InputConnectionHandler

        public InputConnectionHandler​(IInternalAccess component,
                                      java.util.Map<java.lang.String,​java.lang.Object> nonfunc)
        Create a new input connection handler.
    • Method Detail

      • closeReceived

        public void closeReceived​(int seqno)
        From initiator. Called when a close message was received. participant acks and closes
        Parameters:
        seqno - The last data packet.
      • addData

        public void addData​(int seqnumber,
                            byte[] dat)
        Called from message service. Uses: data
        Parameters:
        data - The new data.
      • forwardData

        protected void forwardData​(byte[] data)
        Forward the data to the input connection.
      • getSequenceNumber

        public int getSequenceNumber()
        Get the last received sequence number.
        Returns:
        the sequence number.
      • getNextReceivedSequenceNumber

        public int getNextReceivedSequenceNumber()
        Get the next received sequence number.
        Returns:
        the sequence number.
      • createDataTimer

        public void createDataTimer​(long acktimeout)
        Create a new data ack timer. Sends an ack automatically after some timeout.
      • sendDataAck

        protected void sendDataAck()
        Send ack data.
      • sendDataAck

        protected void sendDataAck​(int startseqno,
                                   int endseqno,
                                   boolean stop)
      • getInputConnection

        public InputConnection getInputConnection()
        Get the input connection.
        Returns:
        The input connection.
      • isStop

        protected boolean isStop()
        Test if stop is activated (too much data arrived).
      • notifyDataRead

        public void notifyDataRead()
        Called by connection when user read some data so that other side can continue to send.
        Specified by:
        notifyDataRead in interface IInputConnectionHandler