Class LinkImpl

    • Method Detail

      • getName

        public java.lang.String getName()
        Description copied from interface: Link
        Returns the name of the link
        Specified by:
        getName in interface Link
        Returns:
        the link name
      • delivery

        public DeliveryImpl delivery​(byte[] tag)
        Description copied from interface: Link
        Create a delivery object based on the specified tag and adds it to the this link's delivery list and its connection work list. TODO to clarify - this adds the delivery to the connection list. It is not yet clear why this is done or if it is useful for the application to be able to discover newly created deliveries from the Connection.getWorkHead().
        Specified by:
        delivery in interface Link
        Parameters:
        tag - a tag for the delivery
        Returns:
        a new Delivery object
      • delivery

        public DeliveryImpl delivery​(byte[] tag,
                                     int offset,
                                     int length)
        Description copied from interface: Link
        Create a delivery object based on the specified tag. This form of the method is intended to allow the tag to be formed from a subsequence of the byte array passed in. This might allow more optimisation options in future but at present is not implemented.
        Specified by:
        delivery in interface Link
        Parameters:
        tag - a tag for the delivery
        offset - (currently ignored and must be 0)
        length - (currently ignored and must be the length of the tag array
        Returns:
        a Delivery object
      • current

        public DeliveryImpl current()
        Description copied from interface: Link
        Returns the current delivery
        Specified by:
        current in interface Link
      • 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
        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
      • setSource

        public void setSource​(Source source)
        Description copied from interface: Link
        Sets the source for this link. The initiator of the link must always provide a Source. An application responding to the creation of the link should perform an application specific lookup on the Link.getRemoteSource() to determine an actual Source. If it failed to determine an actual source, it should set null, and then go on to Endpoint.close() the link.
        Specified by:
        setSource in interface Link
        See Also:
        "AMQP Spec 1.0 section 2.6.3"
      • getCredit

        public int getCredit()
        Description copied from interface: Link
        Gets the credit balance for a link. Note that a sending link may still be used to send deliveries even if link credit is/reaches zero, however those deliveries will end up being queued by the link until enough credit is obtained from the receiver to send them over the wire. In this case the balance reported will go negative.
        Specified by:
        getCredit in interface Link
        Returns:
        the credit balance for the link
      • addCredit

        public void addCredit​(int credit)
      • setCredit

        public void setCredit​(int credit)
      • getQueued

        public int getQueued()
        Description copied from interface: Link
        Gets the number of queued messages for a link. Links may queue deliveries for a number of reasons, for example there may be insufficient credit to send them to the receiver, they may not have yet had a chance to be written to the wire, or the receiving application has simply not yet processed them.
        Specified by:
        getQueued in interface Link
        Returns:
        the queued message count for the link
      • getUnsettled

        public int getUnsettled()
        Specified by:
        getUnsettled in interface Link
      • getDrain

        public boolean getDrain()
        Specified by:
        getDrain in interface Link
      • setSenderSettleMode

        public void setSenderSettleMode​(SenderSettleMode senderSettleMode)
        Description copied from interface: Link
        Sets the sender settle mode. Should only be called during link set-up, i.e. before calling Endpoint.open(). If this endpoint is the initiator of the link, this method can be used to set a value other than the default. If this endpoint is not the initiator, this method should be used to set a local value. According to the AMQP spec, the application may choose to accept the sender's suggestion (accessed by calling Link.getRemoteSenderSettleMode()) or choose another value. The value has no effect on Proton, but may be useful to the application at a later point. In order to be AMQP compliant the application is responsible for honouring the settlement mode. See Link.
        Specified by:
        setSenderSettleMode in interface Link
      • setRemoteSenderSettleMode

        public void setRemoteSenderSettleMode​(SenderSettleMode remoteSenderSettleMode)
        Description copied from interface: Link
        TODO should this be part of the interface?
        Specified by:
        setRemoteSenderSettleMode in interface Link
      • setProperties

        public void setProperties​(java.util.Map<Symbol,​java.lang.Object> properties)
        Description copied from interface: Link
        Sets the local link properties, to be conveyed to the peer via the Attach frame when attaching the link to the session. Must be called during link setup, i.e. before calling the Endpoint.open() method.
        Specified by:
        setProperties in interface Link
      • getRemoteProperties

        public java.util.Map<Symbol,​java.lang.Object> getRemoteProperties()
        Description copied from interface: Link
        Gets the remote link properties, as conveyed from the peer via the Attach frame when attaching the link to the session.
        Specified by:
        getRemoteProperties in interface Link
        Returns:
        the properties Map conveyed by the peer, or null if there was none.
      • setDesiredCapabilities

        public void setDesiredCapabilities​(Symbol[] desiredCapabilities)
        Description copied from interface: Link
        Sets the local link desired capabilities, to be conveyed to the peer via the Attach frame when attaching the link to the session. Must be called during link setup, i.e. before calling the Endpoint.open() method.
        Specified by:
        setDesiredCapabilities in interface Link
        Parameters:
        desiredCapabilities - the desired capabilities array to send, or null for none.
      • getRemoteDesiredCapabilities

        public Symbol[] getRemoteDesiredCapabilities()
        Description copied from interface: Link
        Gets the remote link desired capabilities, as conveyed from the peer via the Attach frame when attaching the link to the session.
        Specified by:
        getRemoteDesiredCapabilities in interface Link
        Returns:
        the desired capabilities array conveyed by the peer, or null if there was none.
      • setOfferedCapabilities

        public void setOfferedCapabilities​(Symbol[] offeredCapabilities)
        Description copied from interface: Link
        Sets the local link offered capabilities, to be conveyed to the peer via the Attach frame when attaching the link to the session. Must be called during link setup, i.e. before calling the Endpoint.open() method.
        Specified by:
        setOfferedCapabilities in interface Link
        Parameters:
        offeredCapabilities - the offered capabilities array to send, or null for none.
      • getRemoteOfferedCapabilities

        public Symbol[] getRemoteOfferedCapabilities()
        Description copied from interface: Link
        Gets the remote link offered capabilities, as conveyed from the peer via the Attach frame when attaching the link to the session.
        Specified by:
        getRemoteOfferedCapabilities in interface Link
        Returns:
        the offered capabilities array conveyed by the peer, or null if there was none.
      • setMaxMessageSize

        public void setMaxMessageSize​(UnsignedLong maxMessageSize)
        Description copied from interface: Link
        Sets the local link max message size, to be conveyed to the peer via the Attach frame when attaching the link to the session. Null or 0 means no limit. Must be called during link setup, i.e. before calling the Endpoint.open() method.
        Specified by:
        setMaxMessageSize in interface Link
        Parameters:
        maxMessageSize - the local max message size value, or null to clear. 0 also means no limit.
      • getRemoteMaxMessageSize

        public UnsignedLong getRemoteMaxMessageSize()
        Description copied from interface: Link
        Gets the remote link max message size, as conveyed from the peer via the Attach frame when attaching the link to the session.
        Specified by:
        getRemoteMaxMessageSize in interface Link
        Returns:
        the remote max message size conveyed by the peer, or null if none was set. 0 also means no limit.
      • drained

        public int drained()
        Specified by:
        drained in interface Link
      • head

        public DeliveryImpl head()
        Description copied from interface: Link
        Returns the head delivery on the link.
        Specified by:
        head in interface Link
      • detach

        public void detach()
        Specified by:
        detach in interface Link
      • detached

        public boolean detached()
        Specified by:
        detached in interface Link