Class ProtonEndpoint<E extends Endpoint<E>>
- java.lang.Object
-
- org.apache.qpid.protonj2.engine.impl.ProtonEndpoint<E>
-
- Type Parameters:
E
- The specificEndpoint
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 java.lang.Object implements Endpoint<E>
Proton abstractEndpoint
implementation that provides some common facilities.
-
-
Field Summary
Fields Modifier and Type Field Description protected ProtonEngine
engine
-
Constructor Summary
Constructors Constructor Description ProtonEndpoint(ProtonEngine engine)
Create a newProtonEndpoint
instance with the given Engine as the owner.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description E
closeHandler(EventHandler<E> remoteCloseEventHandler)
Sets a EventHandler for when an AMQP Close frame is received from the remote peer.E
engineShutdownHandler(EventHandler<Engine> engineShutdownEventHandler)
Sets anEventHandler
that is invoked when the engine that supports thisEndpoint
is shutdown via a call toEngine.shutdown()
which indicates a desire to terminate all engine operations.ProtonAttachments
getAttachments()
ErrorCondition
getCondition()
ProtonEngine
getEngine()
<T> T
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.ErrorCondition
getRemoteCondition()
If the remote has closed thisEndpoint
and provided anErrorCondition
as part of the closing AMQP performative then this method will return it.E
localCloseHandler(EventHandler<E> localCloseEventHandler)
Sets aEventHandler
for when an thisEndpoint
is closed locally via a call toEndpoint.close()
Typically used by clients for logging or other state update event processing.E
localOpenHandler(EventHandler<E> localOpenEventHandler)
Sets aEventHandler
for when an thisEndpoint
is opened locally via a call toEndpoint.open()
Typically used by clients for logging or other state update event processing.E
openHandler(EventHandler<E> remoteOpenEventHandler)
Sets a EventHandler for when an AMQP Open frame is received from the remote peer.E
setCondition(ErrorCondition condition)
Sets the localErrorCondition
to be applied to aEndpoint
close.E
setLinkedResource(java.lang.Object resource)
Links a given resource to thisEndpoint
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.qpid.protonj2.engine.Endpoint
close, getDesiredCapabilities, getOfferedCapabilities, getParent, getProperties, getRemoteDesiredCapabilities, getRemoteOfferedCapabilities, getRemoteProperties, isLocallyClosed, isLocallyOpen, isRemotelyClosed, isRemotelyOpen, open, setDesiredCapabilities, setOfferedCapabilities, setProperties
-
-
-
-
Field Detail
-
engine
protected final ProtonEngine engine
-
-
Constructor Detail
-
ProtonEndpoint
public ProtonEndpoint(ProtonEngine engine)
Create a newProtonEndpoint
instance with the given Engine as the owner.
-
-
Method Detail
-
setLinkedResource
public E setLinkedResource(java.lang.Object resource)
Description copied from interface:Endpoint
Links a given resource to thisEndpoint
.
-
getLinkedResource
public <T> T getLinkedResource()
-
getLinkedResource
public <T> T getLinkedResource(java.lang.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 interfaceEndpoint<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()
-
getAttachments
public ProtonAttachments getAttachments()
- Specified by:
getAttachments
in interfaceEndpoint<E extends Endpoint<E>>
- Returns:
- the
Attachments
instance that is associated with thisEndpoint
-
getCondition
public ErrorCondition getCondition()
-
setCondition
public E setCondition(ErrorCondition condition)
Description copied from interface:Endpoint
Sets the localErrorCondition
to be applied to aEndpoint
close.
-
getRemoteCondition
public ErrorCondition getRemoteCondition()
Description copied from interface:Endpoint
If the remote has closed thisEndpoint
and provided anErrorCondition
as part of the closing AMQP performative then this method will return it.- Specified by:
getRemoteCondition
in interfaceEndpoint<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 itsEndpoint
, while a client would listen for the server to open its end of theEndpoint
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.
-
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.
-
localOpenHandler
public E localOpenHandler(EventHandler<E> localOpenEventHandler)
Description copied from interface:Endpoint
Sets aEventHandler
for when an thisEndpoint
is opened locally via a call toEndpoint.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 interfaceEndpoint<E extends Endpoint<E>>
- Parameters:
localOpenEventHandler
- TheEventHandler
to notify when thisEndpoint
is locally opened.- Returns:
- this
Endpoint
instance.
-
localCloseHandler
public E localCloseHandler(EventHandler<E> localCloseEventHandler)
Description copied from interface:Endpoint
Sets aEventHandler
for when an thisEndpoint
is closed locally via a call toEndpoint.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 interfaceEndpoint<E extends Endpoint<E>>
- Parameters:
localCloseEventHandler
- TheEventHandler
to notify when thisEndpoint
is locally closed.- Returns:
- this
Endpoint
instance.
-
engineShutdownHandler
public E engineShutdownHandler(EventHandler<Engine> engineShutdownEventHandler)
Description copied from interface:Endpoint
Sets anEventHandler
that is invoked when the engine that supports thisEndpoint
is shutdown via a call toEngine.shutdown()
which indicates a desire to terminate all engine operations. AnyEndpoint
that 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 closedEndpoint
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.
-
-