Class ReceiverImpl

    • Method Detail

      • advance

        public boolean advance()
        Description copied from interface: Link
        Attempts to advance the current delivery. Advances it to the next delivery if one exists, else null. The behaviour of this method is different for senders and receivers.
        Specified by:
        advance in interface Link
        Specified by:
        advance in interface Receiver
        Overrides:
        advance in class LinkImpl
        Returns:
        true if it can advance, false if it cannot TODO document the meaning of the return value more fully. Currently Senderimpl only returns false if there is no current delivery
      • flow

        public void flow​(int credits)
        Description copied from interface: Receiver
        Adds the specified number of credits. The number of link credits initialises to zero. It is the application's responsibility to call this method to allow the receiver to receive credits more deliveries.
        Specified by:
        flow in interface Receiver
      • recv

        public int recv​(byte[] bytes,
                        int offset,
                        int size)
        Description copied from interface: Receiver
        Receive message data for the current delivery. If the caller takes all the bytes the Receiver currently has for this delivery then it is removed from the Connection's work list. Before considering a delivery to be complete, the caller should examine Delivery.isPartial(). If the delivery is partial, the caller should call Receiver.recv(byte[], int, int) again to receive the additional bytes once the Delivery appears again on the Connection work-list. TODO might the flags other than IO_WORK in DeliveryImpl also prevent the work list being pruned? e.g. what if a slow JMS consumer receives a disposition frame containing state=RELEASED? This is not IO_WORK.
        Specified by:
        recv in interface Receiver
        Parameters:
        bytes - the destination array where the message data is written
        offset - index in the array to start writing data at
        size - the maximum number of bytes to write
        Returns:
        number of bytes written. -1 if there are no more bytes for the current delivery.
        See Also:
        Link.current()
      • recv

        public int recv​(WritableBuffer buffer)
        Description copied from interface: Receiver
        Receive message data for the current delivery.
        Specified by:
        recv in interface Receiver
        Parameters:
        buffer - the buffer to write the message data.
        Returns:
        number of bytes written. -1 if there are no more bytes for the current delivery.
      • recv

        public ReadableBuffer recv()
        Description copied from interface: Receiver
        Receive message data for the current delivery returning the data in a Readable buffer. The delivery will return an empty buffer if there is no pending data to be read or if all data has been read either by a previous call to this method or by a call to one of the other receive methods.
        Specified by:
        recv in interface Receiver
        Returns:
        a ReadableBuffer that contains the currently available data for the current delivery.
      • drain

        public void drain​(int credit)
        Specified by:
        drain in interface Receiver
      • draining

        public boolean draining()
        Specified by:
        draining in interface Receiver
      • setDrain

        public void setDrain​(boolean drain)
        Specified by:
        setDrain in interface Receiver
      • getRemoteCredit

        public int getRemoteCredit()
        Description copied from interface: Link
        Returns a [locally generated] view of credit at the remote peer by considering the current link credit count as well as the effect of any locally queued messages.
        Specified by:
        getRemoteCredit in interface Link
        Returns:
        view of effective remote credit