Class AmqpAbstractResource<R extends JmsResource,E extends org.apache.qpid.proton.engine.Endpoint>
- java.lang.Object
-
- org.apache.qpid.jms.provider.amqp.AmqpAbstractResource<R,E>
-
- Type Parameters:
R- The JmsResource type that describe this resource.E- The AMQP Endpoint that this resource encapsulates.
- All Implemented Interfaces:
AmqpEventSink,AmqpResource
- Direct Known Subclasses:
AmqpConnection,AmqpConsumer,AmqpProducer,AmqpSession,AmqpTemporaryDestination,AmqpTransactionCoordinator
public abstract class AmqpAbstractResource<R extends JmsResource,E extends org.apache.qpid.proton.engine.Endpoint> extends java.lang.Object implements AmqpResource
Abstract base for all AmqpResource implementations to extend. This abstract class wraps up the basic state management bits so that the concrete object don't have to reproduce it. Provides hooks for the subclasses to initialize and shutdown.
-
-
Field Summary
Fields Modifier and Type Field Description protected AsyncResultcloseRequestprotected java.util.concurrent.ScheduledFuture<?>closeTimeoutTask
-
Constructor Summary
Constructors Constructor Description AmqpAbstractResource(R resourceInfo, E endpoint)Creates a new instance with the JmsResource provided, and sets the Endpoint to the given value.AmqpAbstractResource(R resourceInfo, E endpoint, AmqpResourceParent parent)Creates a new instance with the JmsResource provided, and sets the Endpoint to the given value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose(AsyncResult request)protected voidcloseOrDetachEndpoint()Perform the close operation on the managed endpoint.voidcloseResource(AmqpProvider provider, ProviderException cause, boolean remotelyClosed)EgetEndpoint()org.apache.qpid.proton.engine.EndpointStategetLocalState()AmqpResourceParentgetParent()org.apache.qpid.proton.engine.EndpointStategetRemoteState()RgetResourceInfo()voidhandleResourceClosure(AmqpProvider provider, ProviderException error)booleanisAwaitingClose()booleanisClosed()booleanisOpen()voidprocessDeliveryUpdates(AmqpProvider provider, org.apache.qpid.proton.engine.Delivery delivery)Called when the Proton Engine signals an Delivery related event has been triggered for the given endpoint.voidprocessFlowUpdates(AmqpProvider provider)Called when the Proton Engine signals an Flow related event has been triggered for the given endpoint.voidprocessRemoteClose(AmqpProvider provider)Event handler for remote peer close of this resource.voidprocessRemoteDetach(AmqpProvider provider)Event handler for remote peer detach of this resource.voidprocessRemoteOpen(AmqpProvider provider)Event handler for remote peer open of this resource.
-
-
-
Field Detail
-
closeRequest
protected AsyncResult closeRequest
-
closeTimeoutTask
protected java.util.concurrent.ScheduledFuture<?> closeTimeoutTask
-
-
Constructor Detail
-
AmqpAbstractResource
public AmqpAbstractResource(R resourceInfo, E endpoint)
Creates a new instance with the JmsResource provided, and sets the Endpoint to the given value.- Parameters:
resourceInfo- The JmsResource instance that this AmqpResource is managing.endpoint- The Proton Endpoint instance that this object maps to.
-
AmqpAbstractResource
public AmqpAbstractResource(R resourceInfo, E endpoint, AmqpResourceParent parent)
Creates a new instance with the JmsResource provided, and sets the Endpoint to the given value.- Parameters:
resourceInfo- The JmsResource instance that this AmqpResource is managing.endpoint- The Proton Endpoint instance that this object maps to.parent- The parent of this resource (null if no parent).
-
-
Method Detail
-
close
public void close(AsyncResult request)
-
closeResource
public void closeResource(AmqpProvider provider, ProviderException cause, boolean remotelyClosed)
-
handleResourceClosure
public void handleResourceClosure(AmqpProvider provider, ProviderException error)
-
closeOrDetachEndpoint
protected void closeOrDetachEndpoint()
Perform the close operation on the managed endpoint. A subclass may override this method to alter the standard close path such as endpoint detach etc.
-
getEndpoint
public E getEndpoint()
-
getResourceInfo
public R getResourceInfo()
-
getParent
public AmqpResourceParent getParent()
-
isOpen
public boolean isOpen()
-
isClosed
public boolean isClosed()
-
isAwaitingClose
public boolean isAwaitingClose()
-
getLocalState
public org.apache.qpid.proton.engine.EndpointState getLocalState()
-
getRemoteState
public org.apache.qpid.proton.engine.EndpointState getRemoteState()
-
processRemoteOpen
public final void processRemoteOpen(AmqpProvider provider) throws ProviderException
Description copied from interface:AmqpEventSinkEvent handler for remote peer open of this resource.- Specified by:
processRemoteOpenin interfaceAmqpEventSink- Parameters:
provider- the AmqpProvider instance for easier access to fire events.- Throws:
ProviderException- if an error occurs while processing the update.
-
processRemoteDetach
public void processRemoteDetach(AmqpProvider provider) throws ProviderException
Description copied from interface:AmqpEventSinkEvent handler for remote peer detach of this resource.- Specified by:
processRemoteDetachin interfaceAmqpEventSink- Parameters:
provider- the AmqpProvider instance for easier access to fire events.- Throws:
ProviderException- if an error occurs while processing the update.
-
processRemoteClose
public void processRemoteClose(AmqpProvider provider) throws ProviderException
Description copied from interface:AmqpEventSinkEvent handler for remote peer close of this resource.- Specified by:
processRemoteClosein interfaceAmqpEventSink- Parameters:
provider- the AmqpProvider instance for easier access to fire events.- Throws:
ProviderException- if an error occurs while processing the update.
-
processDeliveryUpdates
public void processDeliveryUpdates(AmqpProvider provider, org.apache.qpid.proton.engine.Delivery delivery) throws ProviderException
Description copied from interface:AmqpEventSinkCalled when the Proton Engine signals an Delivery related event has been triggered for the given endpoint.- Specified by:
processDeliveryUpdatesin interfaceAmqpEventSink- Parameters:
provider- the AmqpProvider instance for easier access to fire events.delivery- the Delivery that has an update to its state which needs handled.- Throws:
ProviderException- if an error occurs while processing the update.
-
processFlowUpdates
public void processFlowUpdates(AmqpProvider provider) throws ProviderException
Description copied from interface:AmqpEventSinkCalled when the Proton Engine signals an Flow related event has been triggered for the given endpoint.- Specified by:
processFlowUpdatesin interfaceAmqpEventSink- Parameters:
provider- the AmqpProvider instance for easier access to fire events.- Throws:
ProviderException- if an error occurs while processing the update.
-
-