Class LinkImpl
- java.lang.Object
-
- org.apache.qpid.proton.engine.impl.EndpointImpl
-
- org.apache.qpid.proton.engine.impl.LinkImpl
-
- All Implemented Interfaces:
Endpoint
,Extendable
,Link
,ProtonJEndpoint
- Direct Known Subclasses:
ReceiverImpl
,SenderImpl
public abstract class LinkImpl extends EndpointImpl implements Link
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCredit(int credit)
boolean
advance()
Attempts to advance the current delivery.DeliveryImpl
current()
Returns the current deliveryDeliveryImpl
delivery(byte[] tag)
Create a delivery object based on the specified tag and adds it to the this link's delivery list and its connection work list.DeliveryImpl
delivery(byte[] tag, int offset, int length)
Create a delivery object based on the specified tag.void
detach()
boolean
detached()
int
drained()
protected ConnectionImpl
getConnectionImpl()
int
getCredit()
Gets the credit balance for a link.Symbol[]
getDesiredCapabilities()
Gets the local link desired capabilities.boolean
getDrain()
UnsignedLong
getMaxMessageSize()
Gets the local link max message size.java.lang.String
getName()
Returns the name of the linkSymbol[]
getOfferedCapabilities()
Gets the local link offered capabilities.java.util.Map<Symbol,java.lang.Object>
getProperties()
Gets the local link properties.int
getQueued()
Gets the number of queued messages for a link.ReceiverSettleMode
getReceiverSettleMode()
Symbol[]
getRemoteDesiredCapabilities()
Gets the remote link desired capabilities, as conveyed from the peer via the Attach frame when attaching the link to the session.UnsignedLong
getRemoteMaxMessageSize()
Gets the remote link max message size, as conveyed from the peer via the Attach frame when attaching the link to the session.Symbol[]
getRemoteOfferedCapabilities()
Gets the remote link offered capabilities, as conveyed from the peer via the Attach frame when attaching the link to the session.java.util.Map<Symbol,java.lang.Object>
getRemoteProperties()
Gets the remote link properties, as conveyed from the peer via the Attach frame when attaching the link to the session.ReceiverSettleMode
getRemoteReceiverSettleMode()
SenderSettleMode
getRemoteSenderSettleMode()
Source
getRemoteSource()
Target
getRemoteTarget()
SenderSettleMode
getSenderSettleMode()
SessionImpl
getSession()
Source
getSource()
Target
getTarget()
int
getUnsettled()
DeliveryImpl
head()
Returns the head delivery on the link.Link
next(java.util.EnumSet<EndpointState> local, java.util.EnumSet<EndpointState> remote)
void
setCredit(int credit)
void
setDesiredCapabilities(Symbol[] desiredCapabilities)
Sets the local link desired capabilities, to be conveyed to the peer via the Attach frame when attaching the link to the session.void
setMaxMessageSize(UnsignedLong maxMessageSize)
Sets the local link max message size, to be conveyed to the peer via the Attach frame when attaching the link to the session.void
setOfferedCapabilities(Symbol[] offeredCapabilities)
Sets the local link offered capabilities, to be conveyed to the peer via the Attach frame when attaching the link to the session.void
setProperties(java.util.Map<Symbol,java.lang.Object> properties)
Sets the local link properties, to be conveyed to the peer via the Attach frame when attaching the link to the session.void
setReceiverSettleMode(ReceiverSettleMode receiverSettleMode)
Sets the receiver settle mode.void
setRemoteSenderSettleMode(SenderSettleMode remoteSenderSettleMode)
TODO should this be part of the interface?void
setSenderSettleMode(SenderSettleMode senderSettleMode)
Sets the sender settle mode.void
setSource(Source source)
Sets the source for this link.void
setTarget(Target target)
Expected to be used in a similar manner toLink.setSource(Source)
-
Methods inherited from class org.apache.qpid.proton.engine.impl.EndpointImpl
attachments, close, free, getCondition, getContext, getLocalState, getRemoteCondition, getRemoteState, open, setCondition, setContext
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.qpid.proton.engine.Endpoint
close, free, getCondition, getContext, getLocalState, getRemoteCondition, getRemoteState, open, setCondition, setContext
-
Methods inherited from interface org.apache.qpid.proton.engine.Extendable
attachments
-
Methods inherited from interface org.apache.qpid.proton.engine.Link
getRemoteCredit
-
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:Link
Returns the name of the link
-
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 theConnection.getWorkHead()
.
-
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.
-
current
public DeliveryImpl current()
Description copied from interface:Link
Returns the current delivery
-
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.
-
getConnectionImpl
protected ConnectionImpl getConnectionImpl()
- Specified by:
getConnectionImpl
in classEndpointImpl
-
getSession
public SessionImpl getSession()
- Specified by:
getSession
in interfaceLink
-
getRemoteSource
public Source getRemoteSource()
- Specified by:
getRemoteSource
in interfaceLink
- See Also:
Link.setSource(Source)
-
getRemoteTarget
public Target getRemoteTarget()
- Specified by:
getRemoteTarget
in interfaceLink
- See Also:
Link.setTarget(Target)
-
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 theLink.getRemoteSource()
to determine an actual Source. If it failed to determine an actual source, it should set null, and then go on toEndpoint.close()
the link.
-
setTarget
public void setTarget(Target target)
Description copied from interface:Link
Expected to be used in a similar manner toLink.setSource(Source)
-
next
public Link next(java.util.EnumSet<EndpointState> local, java.util.EnumSet<EndpointState> remote)
-
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 beingqueued
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.
-
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 insufficientcredit
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.
-
getUnsettled
public int getUnsettled()
- Specified by:
getUnsettled
in interfaceLink
-
getSenderSettleMode
public SenderSettleMode getSenderSettleMode()
- Specified by:
getSenderSettleMode
in interfaceLink
-
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 callingEndpoint.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 callingLink.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. SeeLink
.- Specified by:
setSenderSettleMode
in interfaceLink
-
getRemoteSenderSettleMode
public SenderSettleMode getRemoteSenderSettleMode()
- Specified by:
getRemoteSenderSettleMode
in interfaceLink
- See Also:
Link.setSenderSettleMode(SenderSettleMode)
-
setRemoteSenderSettleMode
public void setRemoteSenderSettleMode(SenderSettleMode remoteSenderSettleMode)
Description copied from interface:Link
TODO should this be part of the interface?- Specified by:
setRemoteSenderSettleMode
in interfaceLink
-
getReceiverSettleMode
public ReceiverSettleMode getReceiverSettleMode()
- Specified by:
getReceiverSettleMode
in interfaceLink
-
setReceiverSettleMode
public void setReceiverSettleMode(ReceiverSettleMode receiverSettleMode)
Description copied from interface:Link
Sets the receiver settle mode. Used in analogous way toLink.setSenderSettleMode(SenderSettleMode)
- Specified by:
setReceiverSettleMode
in interfaceLink
-
getRemoteReceiverSettleMode
public ReceiverSettleMode getRemoteReceiverSettleMode()
- Specified by:
getRemoteReceiverSettleMode
in interfaceLink
- See Also:
Link.setReceiverSettleMode(ReceiverSettleMode)
-
getProperties
public java.util.Map<Symbol,java.lang.Object> getProperties()
Description copied from interface:Link
Gets the local link properties.- Specified by:
getProperties
in interfaceLink
- See Also:
Link.setProperties(Map)
-
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 theEndpoint.open()
method.- Specified by:
setProperties
in interfaceLink
-
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 interfaceLink
- Returns:
- the properties Map conveyed by the peer, or null if there was none.
-
getDesiredCapabilities
public Symbol[] getDesiredCapabilities()
Description copied from interface:Link
Gets the local link desired capabilities.- Specified by:
getDesiredCapabilities
in interfaceLink
- Returns:
- the desired capabilities array, or null if none was set.
- See Also:
Link.setDesiredCapabilities(Symbol[])
-
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 theEndpoint.open()
method.- Specified by:
setDesiredCapabilities
in interfaceLink
- 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 interfaceLink
- Returns:
- the desired capabilities array conveyed by the peer, or null if there was none.
-
getOfferedCapabilities
public Symbol[] getOfferedCapabilities()
Description copied from interface:Link
Gets the local link offered capabilities.- Specified by:
getOfferedCapabilities
in interfaceLink
- Returns:
- the offered capabilities array, or null if none was set.
- See Also:
Link.setOfferedCapabilities(Symbol[])
-
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 theEndpoint.open()
method.- Specified by:
setOfferedCapabilities
in interfaceLink
- 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 interfaceLink
- Returns:
- the offered capabilities array conveyed by the peer, or null if there was none.
-
getMaxMessageSize
public UnsignedLong getMaxMessageSize()
Description copied from interface:Link
Gets the local link max message size.- Specified by:
getMaxMessageSize
in interfaceLink
- Returns:
- the local max message size, or null if none was set. 0 also means no limit.
- See Also:
Link.setMaxMessageSize(UnsignedLong)
-
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 theEndpoint.open()
method.- Specified by:
setMaxMessageSize
in interfaceLink
- 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 interfaceLink
- Returns:
- the remote max message size conveyed by the peer, or null if none was set. 0 also means no limit.
-
head
public DeliveryImpl head()
Description copied from interface:Link
Returns the head delivery on the link.
-
-