org.mule.devkit.dynamic.api.helper
Interface ConnectionManager<K,C extends Connection>

Type Parameters:
K - Connection key
C - Actual connector object that represents a connection

public interface ConnectionManager<K,C extends Connection>

Wrapper around Connector annotated class that will infuse it with connection management capabilities.

It can receive a PoolingProfile which is a configuration object used to define the connection pooling parameters.


Method Summary
 C acquireConnection(K connectorKey)
          Borrow a connection from the pool
 void destroyConnection(K connectorKey, C connector)
          Destroy a connection
 org.mule.config.PoolingProfile getConnectionPoolingProfile()
          Retrieve the connection pooling profile
 K getDefaultConnectionKey()
          Retrieve the default connection key
 org.mule.api.retry.RetryPolicyTemplate getRetryPolicyTemplate()
          Retrieve the reconnection strategy used by this connection manager.
 void releaseConnection(K connectorKey, C connector)
          Return a connection to the pool
 void setConnectionPoolingProfile(org.mule.config.PoolingProfile value)
          Set the connection pooling profile
 

Method Detail

setConnectionPoolingProfile

void setConnectionPoolingProfile(org.mule.config.PoolingProfile value)
Set the connection pooling profile

Parameters:
value - PoolingProfile representing the pooling parameters

getConnectionPoolingProfile

org.mule.config.PoolingProfile getConnectionPoolingProfile()
Retrieve the connection pooling profile

Returns:
PoolingProfile representing the pooling parameters

acquireConnection

C acquireConnection(K connectorKey)
                                       throws Exception
Borrow a connection from the pool

Parameters:
connectorKey - Key used to borrow the connector
Returns:
An existing connector, or a newly created one
Throws:
Exception - If the connection cannot be created

releaseConnection

void releaseConnection(K connectorKey,
                       C connector)
                       throws Exception
Return a connection to the pool

Parameters:
connectorKey - Key used to borrow the connector
connector - connector to be returned to the pool
Throws:
Exception - If the connection cannot be returned

destroyConnection

void destroyConnection(K connectorKey,
                       C connector)
                       throws Exception
Destroy a connection

Parameters:
connectorKey - Key used to borrow the connector
connector - Connector to be destroyed
Throws:
Exception - If the connection could not be destroyed.

getDefaultConnectionKey

K getDefaultConnectionKey()
Retrieve the default connection key

Returns:
The default connection key

getRetryPolicyTemplate

org.mule.api.retry.RetryPolicyTemplate getRetryPolicyTemplate()
Retrieve the reconnection strategy used by this connection manager.

Returns:
The reconnection strategy RetryPolicyTemplate


Copyright © 2010–2015 MuleSoft, Inc.. All rights reserved.