Package org.apache.qpid.protonj2.engine
Interface Endpoint<E extends Endpoint<E>>
- 
- Type Parameters:
- E- The- Endpointtype
 - All Known Subinterfaces:
- Connection,- Link<L>,- Receiver,- Sender,- Session,- TransactionController,- TransactionManager
 - All Known Implementing Classes:
- ProtonConnection,- ProtonEndpoint,- ProtonLink,- ProtonReceiver,- ProtonSender,- ProtonSession,- ProtonTransactionController,- ProtonTransactionManager
 
 public interface Endpoint<E extends Endpoint<E>>Represents a conceptual endpoint type used to provide common operations that all the endpoint types will share.
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description Eclose()Close the end point locally and send the closing performative immediately if possible or holds it until the Connection / Engine state allows it.EcloseHandler(EventHandler<E> remoteCloseEventHandler)Sets a EventHandler for when an AMQP Close frame is received from the remote peer.EengineShutdownHandler(EventHandler<Engine> engineShutdownEventHandler)Sets anEventHandlerthat is invoked when the engine that supports thisEndpointis shutdown via a call toEngine.shutdown()which indicates a desire to terminate all engine operations.AttachmentsgetAttachments()ErrorConditiongetCondition()Symbol[]getDesiredCapabilities()EnginegetEngine()<T> TgetLinkedResource()<T> TgetLinkedResource(java.lang.Class<T> typeClass)Gets the linked resource (if set) and returns it using the type information provided to cast the returned value.Symbol[]getOfferedCapabilities()Endpoint<?>getParent()Gets the parent of thisEndpointwhich can be itself forConnectioninstance.java.util.Map<Symbol,java.lang.Object>getProperties()ErrorConditiongetRemoteCondition()If the remote has closed thisEndpointand provided anErrorConditionas part of the closing AMQP performative then this method will return it.Symbol[]getRemoteDesiredCapabilities()Symbol[]getRemoteOfferedCapabilities()java.util.Map<Symbol,java.lang.Object>getRemoteProperties()booleanisLocallyClosed()booleanisLocallyOpen()booleanisRemotelyClosed()booleanisRemotelyOpen()ElocalCloseHandler(EventHandler<E> localCloseHandler)Sets aEventHandlerfor when an thisEndpointis closed locally via a call toclose()Typically used by clients for logging or other state update event processing.ElocalOpenHandler(EventHandler<E> localOpenHandler)Sets aEventHandlerfor when an thisEndpointis opened locally via a call toopen()Typically used by clients for logging or other state update event processing.Eopen()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.EopenHandler(EventHandler<E> remoteOpenEventHandler)Sets a EventHandler for when an AMQP Open frame is received from the remote peer.EsetCondition(ErrorCondition condition)Sets the localErrorConditionto be applied to aEndpointclose.EsetDesiredCapabilities(Symbol... capabilities)Sets the capabilities that are desired from the remote when thisEndpointis opened.EsetLinkedResource(java.lang.Object resource)Links a given resource to thisEndpoint.EsetOfferedCapabilities(Symbol... capabilities)Sets the capabilities to be offered on to the remote when thisEndpointis opened.EsetProperties(java.util.Map<Symbol,java.lang.Object> properties)Sets the properties to be sent to the remote when thisEndpointis Opened.
 
- 
- 
- 
Method Detail- 
openE open() throws EngineStateException 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. The end point will signal any registered handler of the remote opening the Connection once the remote performative that signals open completion arrives.- Returns:
- this Endpointinstance.
- Throws:
- EngineStateException- if an error occurs opening the Connection or the Engine is shutdown.
 
 - 
closeE close() throws EngineFailedException Close 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.- Returns:
- this Endpointinstance.
- Throws:
- EngineFailedException- if an error occurs closing the end point or the Engine is in a failed state.
 
 - 
getAttachmentsAttachments getAttachments() - Returns:
- the Attachmentsinstance that is associated with thisEndpoint
 
 - 
getParentEndpoint<?> getParent() Gets the parent of thisEndpointwhich can be itself forConnectioninstance.- Returns:
- the parent of this Endpointor itself if this is aConnection;
 
 - 
setLinkedResourceE setLinkedResource(java.lang.Object resource) Links a given resource to thisEndpoint.
 - 
getLinkedResource<T> T getLinkedResource() - Type Parameters:
- T- The type that the linked resource should be cast to on return.
- Returns:
- the user set linked resource for this Endpointinstance.
 
 - 
getLinkedResource<T> T getLinkedResource(java.lang.Class<T> typeClass) Gets the linked resource (if set) and returns it using the type information provided to cast the returned value.- Type Parameters:
- T- The type to cast the linked resource to if one is set.
- Parameters:
- typeClass- the type's Class which is used for casting the returned value.
- Returns:
- the user set linked resource for this Context instance.
- Throws:
- java.lang.ClassCastException- if the linked resource cannot be cast to the type requested.
 
 - 
getConditionErrorCondition getCondition() - Returns:
- the local Endpointerror, or null if there is none
 
 - 
setConditionE setCondition(ErrorCondition condition) Sets the localErrorConditionto be applied to aEndpointclose.- Parameters:
- condition- The error condition to convey to the remote peer on close of this end point.
- Returns:
- this Endpointinstance.
 
 - 
isLocallyOpenboolean isLocallyOpen() Returns true if thisEndpointis currently locally open meaning that theopen()has been called but theclose()has not.- Returns:
- trueif the- Endpointis locally open.
- See Also:
- isLocallyClosed()
 
 - 
isLocallyClosedboolean isLocallyClosed() Returns true if thisEndpointis currently locally closed meaning that a call to theclose()method has occurred.- Returns:
- trueif the- Endpointis locally closed.
- See Also:
- isLocallyOpen()
 
 - 
setOfferedCapabilitiesE setOfferedCapabilities(Symbol... capabilities) throws java.lang.IllegalStateException 
 - 
getOfferedCapabilitiesSymbol[] getOfferedCapabilities() - Returns:
- the configured capabilities that are offered to the remote when the Endpointis opened.
 
 - 
setDesiredCapabilitiesE setDesiredCapabilities(Symbol... capabilities) throws java.lang.IllegalStateException 
 - 
getDesiredCapabilitiesSymbol[] getDesiredCapabilities() - Returns:
- the configured desired capabilities that are sent to the remote when the Connection is opened.
 
 - 
setPropertiesE setProperties(java.util.Map<Symbol,java.lang.Object> properties) throws java.lang.IllegalStateException 
 - 
getPropertiesjava.util.Map<Symbol,java.lang.Object> getProperties() - Returns:
- the configured properties sent to the remote when this Connection is opened.
 
 - 
isRemotelyOpenboolean isRemotelyOpen() Returns true if thisEndpointis currently remotely open meaning that the AMQP performative that completes the open phase of thisEndpoint's lifetime has arrived but the performative that closes it has not.- Returns:
- trueif the- Endpointis remotely open.
- See Also:
- isRemotelyClosed()
 
 - 
isRemotelyClosedboolean isRemotelyClosed() Returns true if thisEndpointis currently remotely closed meaning that the AMQP performative that completes the close phase of thisEndpoint's lifetime has arrived.- Returns:
- trueif the- Endpointis remotely closed.
- See Also:
- isRemotelyOpen()
 
 - 
getRemoteConditionErrorCondition getRemoteCondition() If the remote has closed thisEndpointand provided anErrorConditionas part of the closing AMQP performative then this method will return it.- Returns:
- the remote supplied ErrorCondition, or null if there is none.
 
 - 
getRemoteOfferedCapabilitiesSymbol[] getRemoteOfferedCapabilities() - Returns:
- the capabilities offered by the remote when it opened its end of the Endpoint.
 
 - 
getRemoteDesiredCapabilitiesSymbol[] getRemoteDesiredCapabilities() - Returns:
- the capabilities desired by the remote when it opened its end of the Endpoint.
 
 - 
getRemotePropertiesjava.util.Map<Symbol,java.lang.Object> getRemoteProperties() - Returns:
- the properties sent by the remote when it opened its end of the Endpoint.
 
 - 
localOpenHandlerE localOpenHandler(EventHandler<E> localOpenHandler) Sets aEventHandlerfor when an thisEndpointis opened locally via a call toopen()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.- Parameters:
- localOpenHandler- The- EventHandlerto notify when this- Endpointis locally opened.
- Returns:
- this Endpointinstance.
 
 - 
localCloseHandlerE localCloseHandler(EventHandler<E> localCloseHandler) Sets aEventHandlerfor when an thisEndpointis closed locally via a call toclose()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.- Parameters:
- localCloseHandler- The- EventHandlerto notify when this- Endpointis locally closed.
- Returns:
- this Endpointinstance.
 
 - 
openHandlerE openHandler(EventHandler<E> remoteOpenEventHandler) Sets a EventHandler for when an AMQP Open frame is received from the remote peer. Used to process remotely initiated Connections. Locally initiated sessions have their own EventHandler invoked instead. This method is typically used by servers to listen for the remote peer to open itsEndpoint, while a client would listen for the server to open its end of theEndpointonce a local open has been performed. Typically used by clients as servers will typically listen to some parent resource event handler to determine if the remote is initiating a resource open.
 - 
closeHandlerE closeHandler(EventHandler<E> remoteCloseEventHandler) Sets a EventHandler for when an AMQP Close frame is received from the remote peer.
 - 
engineShutdownHandlerE engineShutdownHandler(EventHandler<Engine> engineShutdownEventHandler) Sets anEventHandlerthat is invoked when the engine that supports thisEndpointis shutdown via a call toEngine.shutdown()which indicates a desire to terminate all engine operations. AnyEndpointthat has been both locally and remotely closed will not receive this event as it will no longer be tracked by the parent its parentEndpoint. A typical use of this event would be from a locally closedEndpointthat is awaiting response from the remote. If this event fires then there will never be a remote response to any pending operations and the client or server instance should react accordingly to clean up any related resources etc.
 
- 
 
-