java.lang.Object
org.apache.qpid.protonj2.client.impl.ClientLinkType<LinkType,ProtonType>
- Type Parameters:
LinkType- The actual link type implementation ClientSender or ClientReceiverProtonType- 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 Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected static final AtomicIntegerFieldUpdater<ClientLinkType>protected final ClientFuture<LinkType>protected final Schedulerprotected ClientExceptionprotected final Stringprotected final ClientFuture<LinkType>protected final LinkOptions<?>protected Sourceprotected Targetprotected final ClientSession -
Method Summary
Modifier and TypeMethodDescriptionaddress()Returns the address that theLinkinstance will be subscribed to.protected voidclient()voidclose()Requests a close of theLinkat the remote and waits until the Link has been fully closed or until the configured close timeout is exceeded.voidclose(ErrorCondition error) Requests a close of theLinkat the remote and waits until the Link has been fully closed or until the configuredLinkOptions.closeTimeout()is exceeded.closeAsync(ErrorCondition error) String[]Returns the desired capabilities that the remote provided upon successfully opening theLink.voiddetach()Requests a detach of theLinkat the remote and waits until the Link has been fully detached or until the configuredLinkOptions.closeTimeout()is exceeded.voiddetach(ErrorCondition error) Requests a detach of theLinkat the remote and waits until the Link has been fully detached or until the configuredLinkOptions.closeTimeout()is exceeded.detachAsync(ErrorCondition error) protected final voidhandleEngineShutdown(Engine engine) protected final voidprotected final voidhandleLocalOpen(ProtonType link) protected final voidprotected final voidprotected final voidhandleRemoteOpen(ProtonType link) protected final voidimmediateLinkShutdown(ClientException failureCause) protected abstract voidlinkSpecificCleanupHandler(ClientException failureCause) protected abstract voidprotected abstract voidprotected abstract voidprotected abstract voidprotected booleannotClosedOrFailed(ClientFuture<?> request) protected booleannotClosedOrFailed(ClientFuture<?> request, ProtonType protonLink) String[]Returns the offered capabilities that the remote provided upon successfully opening theLink.Returns the properties that the remote provided upon successfully opening theLink.protected abstract ProtonTypeprotected abstract voidprotected abstract LinkTypeself()session()source()Returns an immutable view of the remoteSourceobject assigned to this link.target()Returns an immutable view of the remoteTargetobject assigned to this sender link.protected void
-
Field Details
-
CLOSED_UPDATER
-
openFuture
-
closeFuture
-
closed
protected volatile int closed -
failureCause
-
session
-
executor
-
linkId
-
options
-
remoteSource
-
remoteTarget
-
linkRemotelyClosedHandler
-
-
Method Details
-
self
-
protonLink
-
close
public void close()Description copied from interface:LinkRequests a close of theLinkat the remote and waits until the Link has been fully closed or until the configured close timeout is exceeded. -
close
Description copied from interface:LinkRequests a close of theLinkat the remote and waits until the Link has been fully closed or until the configuredLinkOptions.closeTimeout()is exceeded. -
detach
public void detach()Description copied from interface:LinkRequests a detach of theLinkat the remote and waits until the Link has been fully detached or until the configuredLinkOptions.closeTimeout()is exceeded. -
detach
Description copied from interface:LinkRequests a detach of theLinkat the remote and waits until the Link has been fully detached or until the configuredLinkOptions.closeTimeout()is exceeded. -
closeAsync
Description copied from interface:Link -
closeAsync
Description copied from interface:LinkRequests a close of theLinklink at the remote and returns aFuturethat will be completed once the link has been closed.- Specified by:
closeAsyncin interfaceLink<LinkType extends Link<LinkType>>- Parameters:
error- TheErrorConditionto transmit to the remote along with the close operation.- Returns:
- a
Futurethat will be completed when the remote closes thisLinklink.
-
detachAsync
Description copied from interface:Link -
detachAsync
Description copied from interface:LinkRequests a detach of theLinklink at the remote and returns aFuturethat will be completed once the link has been detached.- Specified by:
detachAsyncin interfaceLink<LinkType extends Link<LinkType>>- Parameters:
error- TheErrorConditionto transmit to the remote along with the detach operation.- Returns:
- a
Futurethat will be completed when the remote detaches thisLinklink.
-
address
Description copied from interface:LinkReturns the address that theLinkinstance 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.
-
source
Description copied from interface:Link -
target
Description copied from interface:Link -
properties
Description copied from interface:LinkReturns the properties that the remote provided upon successfully opening theLink. 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:
propertiesin interfaceLink<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 theLinkremote properties.
-
offeredCapabilities
Description copied from interface:LinkReturns the offered capabilities that the remote provided upon successfully opening theLink. 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:
offeredCapabilitiesin interfaceLink<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 theLinkremote offered capabilities.
-
desiredCapabilities
Description copied from interface:LinkReturns the desired capabilities that the remote provided upon successfully opening theLink. 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:
desiredCapabilitiesin interfaceLink<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 theLinkremote desired capabilities.
-
client
-
connection
- Specified by:
connectionin interfaceLink<LinkType extends Link<LinkType>>- Returns:
- the
Connectioninstance that holds this session'sLink
-
session
-
openFuture
-
handleLocalOpen
-
handleLocalCloseOrDetach
-
handleRemoteOpen
-
handleRemoteCloseOrDetach
-
handleParentEndpointClosed
-
handleEngineShutdown
-
immediateLinkShutdown
-
linkSpecificLocalOpenHandler
protected abstract void linkSpecificLocalOpenHandler() -
linkSpecificLocalCloseHandler
protected abstract void linkSpecificLocalCloseHandler() -
linkSpecificRemoteOpenHandler
protected abstract void linkSpecificRemoteOpenHandler() -
linkSpecificRemoteCloseHandler
protected abstract void linkSpecificRemoteCloseHandler() -
linkSpecificCleanupHandler
-
recreateLinkForReconnect
protected abstract void recreateLinkForReconnect() -
notClosedOrFailed
-
notClosedOrFailed
-
checkClosedOrFailed
- Throws:
ClientException
-
waitForOpenToComplete
- Throws:
ClientException
-