Class AmqpConnectionBuilder
- java.lang.Object
-
- org.apache.qpid.jms.provider.amqp.builders.AmqpResourceBuilder<AmqpConnection,AmqpProvider,JmsConnectionInfo,org.apache.qpid.proton.engine.Connection>
-
- org.apache.qpid.jms.provider.amqp.builders.AmqpConnectionBuilder
-
- All Implemented Interfaces:
AmqpEventSink,AmqpExceptionBuilder
- Direct Known Subclasses:
AmqpClosedConnectionBuilder
public class AmqpConnectionBuilder extends AmqpResourceBuilder<AmqpConnection,AmqpProvider,JmsConnectionInfo,org.apache.qpid.proton.engine.Connection>
Resource builder responsible for creating and opening an AmqpConnection instance.
-
-
Field Summary
-
Fields inherited from class org.apache.qpid.jms.provider.amqp.builders.AmqpResourceBuilder
endpoint, parent, provider, request, requestTimeoutTask, resource, resourceInfo
-
-
Constructor Summary
Constructors Constructor Description AmqpConnectionBuilder(AmqpProvider parent, JmsConnectionInfo resourceInfo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidafterOpened()Called once an endpoint has been opened and validated to give the subclasses a place to perform any follow-on processing or setup steps before the operation is deemed to have been completed and success is signaled.voidbuildResource(AsyncResult request)Called to initiate the process of building the resource type that is managed by this builder.protected org.apache.qpid.proton.engine.ConnectioncreateEndpoint(JmsConnectionInfo resourceInfo)Given the resource information provided create and configure the local endpoint whose open phase is managed by this builder.protected AsyncResultcreateRequestIntercepter(AsyncResult request)protected AmqpConnectioncreateResource(AmqpProvider parent, JmsConnectionInfo resourceInfo, org.apache.qpid.proton.engine.Connection endpoint)Create the managed resource instance.protected ProviderExceptiongetDefaultOpenAbortException()When aborting the open operation, and there isn't an error condition, provided by the peer, the returned exception will be used instead.protected ProviderExceptiongetOpenAbortExceptionFromRemote()When aborting the open operation, this method will attempt to create an appropriate exception from the remote error condition if one is set and will revert to creating the default variant if not.protected longgetRequestTimeout()Returns the configured time before the open of the resource is considered to have failed.protected booleanisClosePending()If the resource was opened but its current state indicates a close is pending then we do no need to proceed further into the resource creation process.-
Methods inherited from class org.apache.qpid.jms.provider.amqp.builders.AmqpResourceBuilder
afterClosed, createException, getEndpoint, getParent, getRequest, getResource, getResourceInfo, handleClosed, handleOpened, hasRemoteError, isOpenedEndpointValid, processDeliveryUpdates, processFlowUpdates, processRemoteClose, processRemoteDetach, processRemoteOpen
-
-
-
-
Constructor Detail
-
AmqpConnectionBuilder
public AmqpConnectionBuilder(AmqpProvider parent, JmsConnectionInfo resourceInfo)
-
-
Method Detail
-
buildResource
public void buildResource(AsyncResult request)
Description copied from class:AmqpResourceBuilderCalled to initiate the process of building the resource type that is managed by this builder. The resource is created and the open process occurs asynchronously. If the resource is successfully opened it will added to its parent resource for use.- Overrides:
buildResourcein classAmqpResourceBuilder<AmqpConnection,AmqpProvider,JmsConnectionInfo,org.apache.qpid.proton.engine.Connection>- Parameters:
request- The request that initiated the resource creation.
-
createRequestIntercepter
protected AsyncResult createRequestIntercepter(AsyncResult request)
-
createEndpoint
protected org.apache.qpid.proton.engine.Connection createEndpoint(JmsConnectionInfo resourceInfo)
Description copied from class:AmqpResourceBuilderGiven the resource information provided create and configure the local endpoint whose open phase is managed by this builder.- Specified by:
createEndpointin classAmqpResourceBuilder<AmqpConnection,AmqpProvider,JmsConnectionInfo,org.apache.qpid.proton.engine.Connection>- Returns:
- a new endpoint to be managed.
-
createResource
protected AmqpConnection createResource(AmqpProvider parent, JmsConnectionInfo resourceInfo, org.apache.qpid.proton.engine.Connection endpoint)
Description copied from class:AmqpResourceBuilderCreate the managed resource instance.- Specified by:
createResourcein classAmqpResourceBuilder<AmqpConnection,AmqpProvider,JmsConnectionInfo,org.apache.qpid.proton.engine.Connection>- Parameters:
parent- The parent of the newly created resource.resourceInfo- The resource information used to configure the resource.endpoint- The local endpoint for the managed resource to wrap.- Returns:
- the resource instance who open life-cycle is managed by this builder.
-
afterOpened
protected void afterOpened()
Description copied from class:AmqpResourceBuilderCalled once an endpoint has been opened and validated to give the subclasses a place to perform any follow-on processing or setup steps before the operation is deemed to have been completed and success is signaled.- Overrides:
afterOpenedin classAmqpResourceBuilder<AmqpConnection,AmqpProvider,JmsConnectionInfo,org.apache.qpid.proton.engine.Connection>
-
getOpenAbortExceptionFromRemote
protected ProviderException getOpenAbortExceptionFromRemote()
Description copied from class:AmqpResourceBuilderWhen aborting the open operation, this method will attempt to create an appropriate exception from the remote error condition if one is set and will revert to creating the default variant if not.- Overrides:
getOpenAbortExceptionFromRemotein classAmqpResourceBuilder<AmqpConnection,AmqpProvider,JmsConnectionInfo,org.apache.qpid.proton.engine.Connection>- Returns:
- an Exception to describes the open failure for this resource.
-
getDefaultOpenAbortException
protected ProviderException getDefaultOpenAbortException()
Description copied from class:AmqpResourceBuilderWhen aborting the open operation, and there isn't an error condition, provided by the peer, the returned exception will be used instead. A subclass may override this method to provide alternative behavior.- Overrides:
getDefaultOpenAbortExceptionin classAmqpResourceBuilder<AmqpConnection,AmqpProvider,JmsConnectionInfo,org.apache.qpid.proton.engine.Connection>- Returns:
- an Exception to describes the open failure for this resource.
-
isClosePending
protected boolean isClosePending()
Description copied from class:AmqpResourceBuilderIf the resource was opened but its current state indicates a close is pending then we do no need to proceed further into the resource creation process. Each endpoint build must implement this and examine the opened endpoint to determine if a close frame will follow the open.- Specified by:
isClosePendingin classAmqpResourceBuilder<AmqpConnection,AmqpProvider,JmsConnectionInfo,org.apache.qpid.proton.engine.Connection>- Returns:
- true if the resource state indicates it will be immediately closed.
-
getRequestTimeout
protected long getRequestTimeout()
Description copied from class:AmqpResourceBuilderReturns the configured time before the open of the resource is considered to have failed. Subclasses can override this method to provide a value more appropriate to the resource being built.- Overrides:
getRequestTimeoutin classAmqpResourceBuilder<AmqpConnection,AmqpProvider,JmsConnectionInfo,org.apache.qpid.proton.engine.Connection>- Returns:
- the configured timeout before the open of the resource fails.
-
-