Class ProtonLink<L extends Link<L>>
- Direct Known Subclasses:
- ProtonReceiver,- ProtonSender
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected final ProtonConnectionprotected final Attachprotected Attachprotected final ProtonSessionFields inherited from class org.apache.qpid.protonj2.engine.impl.ProtonEndpointengine
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedProtonLink(ProtonSession session, String name, ProtonLinkCreditState creditState) Create a new link instance with the given parent session.
- 
Method SummaryModifier and TypeMethodDescriptionprotected booleanprotected voidcheckLinkOperable(String failurePrefix) protected voidcheckNotClosed(String errorMessage) protected voidcheckNotOpened(String errorMessage) close()Close the end point locally and send the closing performative immediately if possible or holds it until the Connection / Engine state allows it.protected abstract LdecorateOutgoingFlow(Flow flow) detach()Detach this end of the link.detachHandler(EventHandler<L> remoteDetachHandler) Sets aEventHandlerfor when an AMQP Detach frame is received from the remote peer for thisLinkwhich would have been locally opened previously, the Detach from would have been marked as not having been closed.Symbol[]Gets the local link max message size.getName()Symbol[]Gets the parent of thisEndpointwhich can be itself forConnectioninstance.Gets the local link receiver settlement mode.Symbol[]Gets the remote link max message size, as conveyed from the peer via the Attach frame when attaching the link to the session.Symbol[]Gets the remote link receiver settlement mode, as conveyed from the peer via the Attach frame when attaching the link to the session.Gets the remote link sender settlement mode, as conveyed from the peer via the Attach frame when attaching the link to the session.<T extends Terminus>
 TReturns the remote targetTerminuscast to the given type.Gets the local link sender settlement mode.getState()<T extends Terminus>
 TReturns the currently set Target for thisLink.protected abstract LhandleRemoteAttach(Attach attach) protected abstract LhandleRemoteDetach(Detach detach) protected abstract LhandleRemoteDisposition(Disposition disposition, ProtonIncomingDelivery delivery) protected abstract LhandleRemoteDisposition(Disposition disposition, ProtonOutgoingDelivery delivery) protected abstract LhandleRemoteFlow(Flow flow) protected abstract ProtonIncomingDeliveryhandleRemoteTransfer(Transfer transfer, ProtonBuffer payload) booleanReturns true if thisEndpointis currently locally closed meaning that a call to theEndpoint.close()method has occurred.booleanReturns true if thisLinkis currently locally detached or locally closed meaning the state returned fromLink.getState()is equal toLinkState.DETACHEDorLinkState.CLOSED.booleanReturns true if thisLinkis currently locally detached meaning the state returned fromLink.getState()is equal toLinkState.DETACHED.booleanReturns true if thisEndpointis currently locally open meaning that theEndpoint.open()has been called but theEndpoint.close()has not.booleanbooleanReturns true if thisLinkis currently remotely closed meaning the state returned fromLink.getRemoteState()is equal toLinkState.CLOSED.booleanReturns true if thisLinkis currently remotely detached or closed meaning the state returned fromLink.getRemoteState()is equal toLinkState.DETACHEDorLinkState.CLOSED.booleanReturns true if thisLinkis currently remotely detached meaning the state returned fromLink.getRemoteState()is equal toLinkState.DETACHED.booleanReturns true if thisLinkis currently remotely open meaning the state returned fromLink.getRemoteState()is equal toLinkState.ACTIVE.booleanisSender()localDetachHandler(EventHandler<L> localDetachHandler) Sets aEventHandlerfor when an this link is detached locally via a call toLink.detach()This is a convenience event that supplements the normalEndpoint.localCloseHandler(EventHandler)event point if set.open()Open the end point locally, sending the Open performative immediately if possible or holding it until SASL negotiations or the AMQP header exchange and other required performative exchanges has completed.parentEndpointClosedHandler(EventHandler<L> handler) protected abstract Lself()setDesiredCapabilities(Symbol... capabilities) Sets the capabilities that are desired from the remote when thisEndpointis opened.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.setOfferedCapabilities(Symbol... capabilities) Sets the capabilities to be offered on to the remote when thisEndpointis opened.setProperties(Map<Symbol, Object> properties) Sets the properties to be sent to the remote when thisEndpointis Opened.setReceiverSettleMode(ReceiverSettleMode receiverSettleMode) Sets the receiver settle mode.setSenderSettleMode(SenderSettleMode senderSettleMode) Sets the sender settle mode.setTarget(Coordinator coordinator) Sets theCoordinatortarget to assign to the local end of thisLink.protected voidprotected voidprotected voidprotected voidprotected voidprotected voidprotected voidprotected voidMethods inherited from class org.apache.qpid.protonj2.engine.impl.ProtonEndpointcloseHandler, engineShutdownHandler, getAttachments, getCondition, getEngine, getLinkedResource, getLinkedResource, getRemoteCondition, localCloseHandler, localOpenHandler, openHandler, setCondition, setLinkedResourceMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.qpid.protonj2.engine.EndpointcloseHandler, engineShutdownHandler, getAttachments, getCondition, getEngine, getLinkedResource, getLinkedResource, getRemoteCondition, localCloseHandler, localOpenHandler, openHandler, setCondition, setLinkedResourceMethods inherited from interface org.apache.qpid.protonj2.engine.LinkcreditStateUpdateHandler, getCredit, getRole, isDraining
- 
Field Details- 
connection
- 
session
- 
localAttach
- 
remoteAttach
 
- 
- 
Constructor Details
- 
Method Details- 
getConnection- Specified by:
- getConnectionin interface- Link<L extends Link<L>>
- Returns:
- the parent Connectionfor theLink
 
- 
getSession
- 
getParentDescription copied from interface:EndpointGets the parent of thisEndpointwhich can be itself forConnectioninstance.
- 
getName
- 
isSenderpublic boolean isSender()
- 
isReceiverpublic boolean isReceiver()
- 
self
- 
getState
- 
getRemoteState- Specified by:
- getRemoteStatein interface- Link<L extends Link<L>>
- Returns:
- the remote link state (as last communicated)
 
- 
openDescription copied from interface:EndpointOpen the end point locally, sending the Open performative immediately if possible or holding it until SASL negotiations or the AMQP header exchange and other required performative exchanges has completed. The end point will signal any registered handler of the remote opening the Connection once the remote performative that signals open completion arrives.
- 
detachDescription copied from interface:LinkDetach this end of the link.
- 
closeDescription copied from interface:EndpointClose the end point locally and send the closing performative immediately if possible or holds it until the Connection / Engine state allows it. If the engine encounters an error writing the performative or the engine is in a failed state from a previous error then this method will throw an exception. If the engine has been shutdown then this method will close out the local end of theEndpointand clean up any local resources before returning normally.
- 
setSenderSettleModeDescription copied from interface:LinkSets 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 honoring the settlement mode. See Link.- Specified by:
- setSenderSettleModein interface- Link<L extends Link<L>>
- Parameters:
- senderSettleMode- The- SenderSettleModethat will be set on the local end of this link.
- Returns:
- this Link.
 
- 
getSenderSettleModeDescription copied from interface:LinkGets the local link sender settlement mode.- Specified by:
- getSenderSettleModein interface- Link<L extends Link<L>>
- Returns:
- the local sender settlement mode, or null if none was set.
- See Also:
 
- 
setReceiverSettleModeDescription copied from interface:LinkSets the receiver 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. Used in analogous way toLink.setSenderSettleMode(SenderSettleMode)- Specified by:
- setReceiverSettleModein interface- Link<L extends Link<L>>
- Parameters:
- receiverSettleMode- The- ReceiverSettleModethat will be set on the local end of this link.
- Returns:
- this Link.
 
- 
getReceiverSettleModeDescription copied from interface:LinkGets the local link receiver settlement mode.- Specified by:
- getReceiverSettleModein interface- Link<L extends Link<L>>
- Returns:
- the local receiver settlement mode, or null if none was set.
- See Also:
 
- 
setSourceDescription copied from interface:LinkSets theSourceto assign to the local end of thisLink.Must be called during link setup, i.e. before calling the Endpoint.open()method.
- 
getSource
- 
setTargetDescription copied from interface:LinkSets theTargetto assign to the local end of thisLink. Must be called during link setup, i.e. before calling theEndpoint.open()method.
- 
setTargetDescription copied from interface:LinkSets theCoordinatortarget to assign to the local end of thisLink.Must be called during link setup, i.e. before calling the Endpoint.open()method.- Specified by:
- setTargetin interface- Link<L extends Link<L>>
- Parameters:
- coordinator- The- Coordinatortarget that will be set on the local end of this link.
- Returns:
- this Link.
- Throws:
- IllegalStateException- if the- Linkhas already been opened.
 
- 
getTargetDescription copied from interface:LinkReturns the currently set Target for thisLink. A link target can be either aTargettype for aSenderorReceiverlink or if the link is to be transaction resource then the target type will be aCoordinatorinstance.
- 
setPropertiesDescription copied from interface:EndpointSets the properties to be sent to the remote when thisEndpointis Opened. TheEndpointproperties value can only be modified prior to a call toEndpoint.open(), once theEndpointhas been opened locally an error will be thrown if this method is called.
- 
getProperties- Specified by:
- getPropertiesin interface- Endpoint<L extends Link<L>>
- Returns:
- the configured properties sent to the remote when this Connection is opened.
 
- 
setOfferedCapabilitiesDescription copied from interface:EndpointSets the capabilities to be offered on to the remote when thisEndpointis opened. The offered capabilities value can only be modified prior to a call toEndpoint.open(), once theEndpointhas been opened locally an error will be thrown if this method is called.
- 
getOfferedCapabilities
- 
setDesiredCapabilitiesDescription copied from interface:EndpointSets the capabilities that are desired from the remote when thisEndpointis opened. The desired capabilities value can only be modified prior to a call toEndpoint.open(), once theEndpointhas been opened locally an error will be thrown if this method is called.
- 
getDesiredCapabilities- Specified by:
- getDesiredCapabilitiesin interface- Endpoint<L extends Link<L>>
- Returns:
- the configured desired capabilities that are sent to the remote when the Connection is opened.
 
- 
setMaxMessageSizeDescription copied from interface:LinkSets 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:
- setMaxMessageSizein interface- Link<L extends Link<L>>
- Parameters:
- maxMessageSize- the local max message size value, or null to clear. 0 also means no limit.
- Returns:
- this Link.
 
- 
getMaxMessageSizeDescription copied from interface:LinkGets the local link max message size.- Specified by:
- getMaxMessageSizein interface- Link<L extends Link<L>>
- Returns:
- the local max message size, or null if none was set. 0 also means no limit.
- See Also:
 
- 
isLocallyOpenpublic boolean isLocallyOpen()Description copied from interface:EndpointReturns true if thisEndpointis currently locally open meaning that theEndpoint.open()has been called but theEndpoint.close()has not.
- 
isLocallyClosedpublic boolean isLocallyClosed()Description copied from interface:EndpointReturns true if thisEndpointis currently locally closed meaning that a call to theEndpoint.close()method has occurred.
- 
isLocallyDetachedpublic boolean isLocallyDetached()Description copied from interface:LinkReturns true if thisLinkis currently locally detached meaning the state returned fromLink.getState()is equal toLinkState.DETACHED. A link is locally detached after a call toLink.detach().- Specified by:
- isLocallyDetachedin interface- Link<L extends Link<L>>
- Returns:
- true if the link is locally closed.
- See Also:
 
- 
isLocallyClosedOrDetachedpublic boolean isLocallyClosedOrDetached()Description copied from interface:LinkReturns true if thisLinkis currently locally detached or locally closed meaning the state returned fromLink.getState()is equal toLinkState.DETACHEDorLinkState.CLOSED. A link is locally detached after a call toLink.detach()and is locally closed after a call toEndpoint.close().- Specified by:
- isLocallyClosedOrDetachedin interface- Link<L extends Link<L>>
- Returns:
- true if the link is locally closed or detached.
- See Also:
 
- 
isRemotelyOpenpublic boolean isRemotelyOpen()Description copied from interface:LinkReturns true if thisLinkis currently remotely open meaning the state returned fromLink.getRemoteState()is equal toLinkState.ACTIVE. A link is remotely opened after anAttachhas been received from the remote and before aDetachhas been received from the remote.- Specified by:
- isRemotelyOpenin interface- Endpoint<L extends Link<L>>
- Specified by:
- isRemotelyOpenin interface- Link<L extends Link<L>>
- Returns:
- true if the link is remotely open.
- See Also:
 
- 
isRemotelyClosedpublic boolean isRemotelyClosed()Description copied from interface:LinkReturns true if thisLinkis currently remotely closed meaning the state returned fromLink.getRemoteState()is equal toLinkState.CLOSED. A link is remotely closed after anDetachhas been received from the remote with the close flag equal to true.- Specified by:
- isRemotelyClosedin interface- Endpoint<L extends Link<L>>
- Specified by:
- isRemotelyClosedin interface- Link<L extends Link<L>>
- Returns:
- true if the link is remotely closed.
- See Also:
 
- 
isRemotelyDetachedpublic boolean isRemotelyDetached()Description copied from interface:LinkReturns true if thisLinkis currently remotely detached meaning the state returned fromLink.getRemoteState()is equal toLinkState.DETACHED. A link is remotely detached after anDetachhas been received from the remote with the close flag equal to false.- Specified by:
- isRemotelyDetachedin interface- Link<L extends Link<L>>
- Returns:
- true if the link is remotely detached.
- See Also:
 
- 
isRemotelyClosedOrDetachedpublic boolean isRemotelyClosedOrDetached()Description copied from interface:LinkReturns true if thisLinkis currently remotely detached or closed meaning the state returned fromLink.getRemoteState()is equal toLinkState.DETACHEDorLinkState.CLOSED. A link is remotely detached or closed after aDetachhas been received from the remote.- Specified by:
- isRemotelyClosedOrDetachedin interface- Link<L extends Link<L>>
- Returns:
- true if the link is remotely detached or closed.
- See Also:
 
- 
getRemoteSenderSettleModeDescription copied from interface:LinkGets the remote link sender settlement mode, as conveyed from the peer via the Attach frame when attaching the link to the session.- Specified by:
- getRemoteSenderSettleModein interface- Link<L extends Link<L>>
- Returns:
- the sender settlement mode conveyed by the peer, or null if there was none.
- See Also:
 
- 
getRemoteReceiverSettleModeDescription copied from interface:LinkGets the remote link receiver settlement mode, as conveyed from the peer via the Attach frame when attaching the link to the session.- Specified by:
- getRemoteReceiverSettleModein interface- Link<L extends Link<L>>
- Returns:
- the sender receiver mode conveyed by the peer, or null if there was none.
- See Also:
 
- 
getRemoteSource
- 
getRemoteTargetDescription copied from interface:LinkReturns the remote targetTerminuscast to the given type. This can be used when the underlying type is known by the caller or as a control to validate the assumption of the underlying type.the currently set Target for this Link. A link target can be either aTargettype for aSenderorReceiverlink or if the link is to be transaction resource then the target type will be aCoordinatorinstance.
- 
getRemoteOfferedCapabilities
- 
getRemoteDesiredCapabilities
- 
getRemoteProperties
- 
getRemoteMaxMessageSizeDescription copied from interface:LinkGets the remote link max message size, as conveyed from the peer via the Attach frame when attaching the link to the session.- Specified by:
- getRemoteMaxMessageSizein interface- Link<L extends Link<L>>
- Returns:
- the remote max message size conveyed by the peer, or null if none was set. 0 also means no limit.
 
- 
localDetachHandlerDescription copied from interface:LinkSets aEventHandlerfor when an this link is detached locally via a call toLink.detach()This is a convenience event that supplements the normalEndpoint.localCloseHandler(EventHandler)event point if set. If no local detached event handler is set the endpoint will route the detached event to the local closed event handler if set and allow it to process the event in one location.Typically used by clients for logging or other state update event processing. Clients should not perform any blocking calls within this context. It is an error for the handler to throw an exception and the outcome of doing so is undefined. - Specified by:
- localDetachHandlerin interface- Link<L extends Link<L>>
- Parameters:
- localDetachHandler- The- EventHandlerto notify when this link is locally detached.
- Returns:
- the link for chaining.
 
- 
detachHandlerDescription copied from interface:LinkSets aEventHandlerfor when an AMQP Detach frame is received from the remote peer for thisLinkwhich would have been locally opened previously, the Detach from would have been marked as not having been closed.This is a convenience event that supplements the normal Endpoint.closeHandler(EventHandler)event point if set. If no detached event handler is set the endpoint will route the detached event to the closed event handler if set and allow it to process the event in one location.- Specified by:
- detachHandlerin interface- Link<L extends Link<L>>
- Parameters:
- remoteDetachHandler- The- EventHandlerto notify when this link is remotely closed.
- Returns:
- the Linkfor chaining.
 
- 
parentEndpointClosedHandlerDescription copied from interface:LinkSets aEventHandlerfor when the parentSessionorConnectionof this link is locally closed.Typically used by clients for logging or other state update event processing. Clients should not perform any blocking calls within this context. It is an error for the handler to throw an exception and the outcome of doing so is undefined. - Specified by:
- parentEndpointClosedHandlerin interface- Link<L extends Link<L>>
- Parameters:
- handler- The- EventHandlerto notify when this link's parent Session is locally closed.
- Returns:
- the link for chaining.
 
- 
transitionedToLocallyOpenedprotected void transitionedToLocallyOpened()
- 
transitionedToLocallyDetachedprotected void transitionedToLocallyDetached()
- 
transitionedToLocallyClosedprotected void transitionedToLocallyClosed()
- 
transitionToRemotelyOpenedStateprotected void transitionToRemotelyOpenedState()
- 
transitionToRemotelyDetachedprotected void transitionToRemotelyDetached()
- 
transitionToRemotelyClosedprotected void transitionToRemotelyClosed()
- 
transitionToParentLocallyClosedprotected void transitionToParentLocallyClosed()
- 
transitionToParentRemotelyClosedprotected void transitionToParentRemotelyClosed()
- 
handleRemoteAttach
- 
handleRemoteDetach
- 
handleRemoteFlow
- 
handleRemoteDispositionprotected abstract L handleRemoteDisposition(Disposition disposition, ProtonOutgoingDelivery delivery) 
- 
handleRemoteDispositionprotected abstract L handleRemoteDisposition(Disposition disposition, ProtonIncomingDelivery delivery) 
- 
handleRemoteTransferprotected abstract ProtonIncomingDelivery handleRemoteTransfer(Transfer transfer, ProtonBuffer payload) 
- 
decorateOutgoingFlow
- 
checkLinkOperable
- 
areDeliveriesStillActiveprotected boolean areDeliveriesStillActive()
- 
checkNotOpened
- 
checkNotClosed
 
-