Class ProtonEndpoint<E extends Endpoint<E>>

java.lang.Object
org.apache.qpid.protonj2.engine.impl.ProtonEndpoint<E>
Type Parameters:
E - The specific Endpoint type this abstract type implements.
All Implemented Interfaces:
Endpoint<E>
Direct Known Subclasses:
ProtonConnection, ProtonLink, ProtonSession, ProtonTransactionController, ProtonTransactionManager

public abstract class ProtonEndpoint<E extends Endpoint<E>> extends Object implements Endpoint<E>
Proton abstract Endpoint implementation that provides some common facilities.
  • Field Details

  • Constructor Details

  • Method Details

    • setLinkedResource

      public E setLinkedResource(Object resource)
      Description copied from interface: Endpoint
      Links a given resource to this Endpoint.
      Specified by:
      setLinkedResource in interface Endpoint<E extends Endpoint<E>>
      Parameters:
      resource - The resource to link to this Endpoint.
      Returns:
      this Endpoint instance.
    • getLinkedResource

      public <T> T getLinkedResource()
      Specified by:
      getLinkedResource in interface Endpoint<E extends Endpoint<E>>
      Type Parameters:
      T - The type that the linked resource should be cast to on return.
      Returns:
      the user set linked resource for this Endpoint instance.
    • getLinkedResource

      public <T> T getLinkedResource(Class<T> typeClass)
      Description copied from interface: Endpoint
      Gets the linked resource (if set) and returns it using the type information provided to cast the returned value.
      Specified by:
      getLinkedResource in interface Endpoint<E extends Endpoint<E>>
      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.
    • getEngine

      public ProtonEngine getEngine()
      Specified by:
      getEngine in interface Endpoint<E extends Endpoint<E>>
      Returns:
      the Engine which created this Endpoint instance.
    • getAttachments

      public ProtonAttachments getAttachments()
      Specified by:
      getAttachments in interface Endpoint<E extends Endpoint<E>>
      Returns:
      the Attachments instance that is associated with this Endpoint
    • getCondition

      public ErrorCondition getCondition()
      Specified by:
      getCondition in interface Endpoint<E extends Endpoint<E>>
      Returns:
      the local Endpoint error, or null if there is none
    • setCondition

      public E setCondition(ErrorCondition condition)
      Description copied from interface: Endpoint
      Sets the local ErrorCondition to be applied to a Endpoint close.
      Specified by:
      setCondition in interface Endpoint<E extends Endpoint<E>>
      Parameters:
      condition - The error condition to convey to the remote peer on close of this end point.
      Returns:
      this Endpoint instance.
    • getRemoteCondition

      public ErrorCondition getRemoteCondition()
      Description copied from interface: Endpoint
      If the remote has closed this Endpoint and provided an ErrorCondition as part of the closing AMQP performative then this method will return it.
      Specified by:
      getRemoteCondition in interface Endpoint<E extends Endpoint<E>>
      Returns:
      the remote supplied ErrorCondition, or null if there is none.
    • openHandler

      public E openHandler(EventHandler<E> remoteOpenEventHandler)
      Description copied from interface: Endpoint
      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 its Endpoint, while a client would listen for the server to open its end of the Endpoint once 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.
      Specified by:
      openHandler in interface Endpoint<E extends Endpoint<E>>
      Parameters:
      remoteOpenEventHandler - the EventHandler that will be signaled when the Endpoint has been remotely opened
      Returns:
      this Endpoint instance.
    • closeHandler

      public E closeHandler(EventHandler<E> remoteCloseEventHandler)
      Description copied from interface: Endpoint
      Sets a EventHandler for when an AMQP Close frame is received from the remote peer.
      Specified by:
      closeHandler in interface Endpoint<E extends Endpoint<E>>
      Parameters:
      remoteCloseEventHandler - the EventHandler that will be signaled when the Endpoint is remotely closed.
      Returns:
      this Endpoint instance.
    • localOpenHandler

      public E localOpenHandler(EventHandler<E> localOpenEventHandler)
      Description copied from interface: Endpoint
      Sets a EventHandler for when an this Endpoint is opened locally via a call to Endpoint.open() 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:
      localOpenHandler in interface Endpoint<E extends Endpoint<E>>
      Parameters:
      localOpenEventHandler - The EventHandler to notify when this Endpoint is locally opened.
      Returns:
      this Endpoint instance.
    • localCloseHandler

      public E localCloseHandler(EventHandler<E> localCloseEventHandler)
      Description copied from interface: Endpoint
      Sets a EventHandler for when an this Endpoint is closed locally via a call to Endpoint.close() 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:
      localCloseHandler in interface Endpoint<E extends Endpoint<E>>
      Parameters:
      localCloseEventHandler - The EventHandler to notify when this Endpoint is locally closed.
      Returns:
      this Endpoint instance.
    • engineShutdownHandler

      public E engineShutdownHandler(EventHandler<Engine> engineShutdownEventHandler)
      Description copied from interface: Endpoint
      Sets an EventHandler that is invoked when the engine that supports this Endpoint is shutdown via a call to Engine.shutdown() which indicates a desire to terminate all engine operations. Any Endpoint that has been both locally and remotely closed will not receive this event as it will no longer be tracked by the parent its parent Endpoint. A typical use of this event would be from a locally closed Endpoint that 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.
      Specified by:
      engineShutdownHandler in interface Endpoint<E extends Endpoint<E>>
      Parameters:
      engineShutdownEventHandler - the EventHandler that will be signaled when this Endpoint's engine is explicitly shutdown.
      Returns:
      this Endpoint instance.