Class ClientLinkType<LinkType extends Link<LinkType>,ProtonType extends Link<ProtonType>>

java.lang.Object
org.apache.qpid.protonj2.client.impl.ClientLinkType<LinkType,ProtonType>
Type Parameters:
LinkType - The actual link type implementation ClientSender or ClientReceiver
ProtonType - The proton concrete link type implementation Sender or Receiver
All Implemented Interfaces:
AutoCloseable, Link<LinkType>
Direct Known Subclasses:
ClientReceiverLinkType, ClientSenderLinkType

public abstract class ClientLinkType<LinkType extends Link<LinkType>,ProtonType extends Link<ProtonType>> extends Object implements Link<LinkType>
Base type used by client resources that represent an AMQP link type.
  • Field Details

  • Method Details

    • self

      protected abstract LinkType self()
    • protonLink

      protected abstract ProtonType protonLink()
    • close

      public void close()
      Description copied from interface: Link
      Requests a close of the Link at the remote and waits until the Link has been fully closed or until the configured close timeout is exceeded.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Link<LinkType extends Link<LinkType>>
    • close

      public void close(ErrorCondition error)
      Description copied from interface: Link
      Requests a close of the Link at the remote and waits until the Link has been fully closed or until the configured LinkOptions.closeTimeout() is exceeded.
      Specified by:
      close in interface Link<LinkType extends Link<LinkType>>
      Parameters:
      error - The ErrorCondition to transmit to the remote along with the close operation.
    • detach

      public void detach()
      Description copied from interface: Link
      Requests a detach of the Link at the remote and waits until the Link has been fully detached or until the configured LinkOptions.closeTimeout() is exceeded.
      Specified by:
      detach in interface Link<LinkType extends Link<LinkType>>
    • detach

      public void detach(ErrorCondition error)
      Description copied from interface: Link
      Requests a detach of the Link at the remote and waits until the Link has been fully detached or until the configured LinkOptions.closeTimeout() is exceeded.
      Specified by:
      detach in interface Link<LinkType extends Link<LinkType>>
      Parameters:
      error - The ErrorCondition to transmit to the remote along with the detach operation.
    • closeAsync

      public ClientFuture<LinkType> closeAsync()
      Description copied from interface: Link
      Requests a close of the Link link at the remote and returns a Future that will be completed once the link has been closed.
      Specified by:
      closeAsync in interface Link<LinkType extends Link<LinkType>>
      Returns:
      a Future that will be completed when the remote closes this Link link.
    • closeAsync

      public ClientFuture<LinkType> closeAsync(ErrorCondition error)
      Description copied from interface: Link
      Requests a close of the Link link at the remote and returns a Future that will be completed once the link has been closed.
      Specified by:
      closeAsync in interface Link<LinkType extends Link<LinkType>>
      Parameters:
      error - The ErrorCondition to transmit to the remote along with the close operation.
      Returns:
      a Future that will be completed when the remote closes this Link link.
    • detachAsync

      public ClientFuture<LinkType> detachAsync()
      Description copied from interface: Link
      Requests a detach of the Link link at the remote and returns a Future that will be completed once the link has been detached.
      Specified by:
      detachAsync in interface Link<LinkType extends Link<LinkType>>
      Returns:
      a Future that will be completed when the remote detaches this Link link.
    • detachAsync

      public ClientFuture<LinkType> detachAsync(ErrorCondition error)
      Description copied from interface: Link
      Requests a detach of the Link link at the remote and returns a Future that will be completed once the link has been detached.
      Specified by:
      detachAsync in interface Link<LinkType extends Link<LinkType>>
      Parameters:
      error - The ErrorCondition to transmit to the remote along with the detach operation.
      Returns:
      a Future that will be completed when the remote detaches this Link link.
    • address

      public String address() throws ClientException
      Description copied from interface: Link
      Returns the address that the Link instance will be subscribed to. This method can block based on the type of link and how it was configured.
      • If the link is a Sender and it was configured as an anonymous sender then this method returns null as the link has no address.
      • If a link was created with the dynamic node value enabled then the method will return the dynamically created address once the remote has attached its end of the opened link. Due to the need to await the remote peer to populate the dynamic address this method will block until the open of the link has completed.
      • If not a dynamic link then the address returned is the address passed to the original link creation method.
      Specified by:
      address in interface Link<LinkType extends Link<LinkType>>
      Returns:
      the address that this Link is was assigned to.
      Throws:
      ClientException - if an error occurs while obtaining the Link address.
    • source

      public Source source() throws ClientException
      Description copied from interface: Link
      Returns an immutable view of the remote Source object assigned to this link. If the attach has not completed yet this method will block to await the attach response which carries the remote Source.
      Specified by:
      source in interface Link<LinkType extends Link<LinkType>>
      Returns:
      the remote Source node configuration.
      Throws:
      ClientException - if an error occurs while obtaining the Link remote Source.
    • target

      public Target target() throws ClientException
      Description copied from interface: Link
      Returns an immutable view of the remote Target object assigned to this sender link. If the attach has not completed yet this method will block to await the attach response which carries the remote Target.
      Specified by:
      target in interface Link<LinkType extends Link<LinkType>>
      Returns:
      the remote Target node configuration.
      Throws:
      ClientException - if an error occurs while obtaining the Link remote Target.
    • properties

      public Map<String,Object> properties() throws ClientException
      Description copied from interface: Link
      Returns the properties that the remote provided upon successfully opening the Link. If the attach has not completed yet this method will block to await the attach response which carries the remote properties. If the remote provides no properties this method will return null.
      Specified by:
      properties in interface Link<LinkType extends Link<LinkType>>
      Returns:
      any properties provided from the remote once the sender has successfully opened.
      Throws:
      ClientException - if an error occurs while obtaining the Link remote properties.
    • offeredCapabilities

      public String[] offeredCapabilities() throws ClientException
      Description copied from interface: Link
      Returns the offered capabilities that the remote provided upon successfully opening the Link. If the attach has not completed yet this method will block to await the attach response which carries the remote offered capabilities. If the remote provides no capabilities this method will return null.
      Specified by:
      offeredCapabilities in interface Link<LinkType extends Link<LinkType>>
      Returns:
      any capabilities provided from the remote once the sender has successfully opened.
      Throws:
      ClientException - if an error occurs while obtaining the Link remote offered capabilities.
    • desiredCapabilities

      public String[] desiredCapabilities() throws ClientException
      Description copied from interface: Link
      Returns the desired capabilities that the remote provided upon successfully opening the Link. If the attach has not completed yet this method will block to await the attach response which carries the remote desired capabilities. If the remote provides no capabilities this method will return null.
      Specified by:
      desiredCapabilities in interface Link<LinkType extends Link<LinkType>>
      Returns:
      any desired capabilities provided from the remote once the sender has successfully opened.
      Throws:
      ClientException - if an error occurs while obtaining the Link remote desired capabilities.
    • client

      public ClientInstance client()
      Specified by:
      client in interface Link<LinkType extends Link<LinkType>>
      Returns:
      the Client instance that holds this session's Link
    • connection

      public ClientConnection connection()
      Specified by:
      connection in interface Link<LinkType extends Link<LinkType>>
      Returns:
      the Connection instance that holds this session's Link
    • session

      public ClientSession session()
      Specified by:
      session in interface Link<LinkType extends Link<LinkType>>
      Returns:
      the Session that created and holds this Link.
    • openFuture

      public ClientFuture<LinkType> openFuture()
      Specified by:
      openFuture in interface Link<LinkType extends Link<LinkType>>
      Returns:
      a Future that will be completed when the remote opens this Link.
    • handleLocalOpen

      protected final void handleLocalOpen(ProtonType link)
    • handleLocalCloseOrDetach

      protected final void handleLocalCloseOrDetach(ProtonType link)
    • handleRemoteOpen

      protected final void handleRemoteOpen(ProtonType link)
    • handleRemoteCloseOrDetach

      protected final void handleRemoteCloseOrDetach(ProtonType link)
    • handleParentEndpointClosed

      protected final void handleParentEndpointClosed(ProtonType link)
    • handleEngineShutdown

      protected final void handleEngineShutdown(Engine engine)
    • immediateLinkShutdown

      protected final void immediateLinkShutdown(ClientException failureCause)
    • linkSpecificLocalOpenHandler

      protected abstract void linkSpecificLocalOpenHandler()
    • linkSpecificLocalCloseHandler

      protected abstract void linkSpecificLocalCloseHandler()
    • linkSpecificRemoteOpenHandler

      protected abstract void linkSpecificRemoteOpenHandler()
    • linkSpecificRemoteCloseHandler

      protected abstract void linkSpecificRemoteCloseHandler()
    • linkSpecificCleanupHandler

      protected abstract void linkSpecificCleanupHandler(ClientException failureCause)
    • recreateLinkForReconnect

      protected abstract void recreateLinkForReconnect()
    • notClosedOrFailed

      protected boolean notClosedOrFailed(ClientFuture<?> request)
    • notClosedOrFailed

      protected boolean notClosedOrFailed(ClientFuture<?> request, ProtonType protonLink)
    • checkClosedOrFailed

      protected void checkClosedOrFailed() throws ClientException
      Throws:
      ClientException
    • waitForOpenToComplete

      protected void waitForOpenToComplete() throws ClientException
      Throws:
      ClientException