|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.jca.cci.connection.ConnectionFactoryUtils
public abstract class ConnectionFactoryUtils
Helper class that provides static methods to obtain CCI Connections from a ConnectionFactory, and to close Connections if necessary. Has special support for Spring-managed connections, e.g. for use with CciLocalTransactionManager.
Used internally by CciTemplate, CCI operation objects and the CciLocalTransactionManager. Can also be used directly in application code.
getConnection(javax.resource.cci.ConnectionFactory),
releaseConnection(javax.resource.cci.Connection, javax.resource.cci.ConnectionFactory),
CciLocalTransactionManager,
CciTemplate,
MappingRecordOperation| Constructor Summary | |
|---|---|
ConnectionFactoryUtils()
|
|
| Method Summary | |
|---|---|
static Connection |
doGetConnection(ConnectionFactory cf)
Actually get a CCI Connection for the given ConnectionFactory. |
static void |
doReleaseConnection(Connection con,
ConnectionFactory cf)
Actually close a JCA CCI Connection for the given DataSource. |
static Connection |
getConnection(ConnectionFactory cf)
Get a Connection from the given DataSource. |
static void |
releaseConnection(Connection con,
ConnectionFactory cf)
Close the given Connection if necessary, i.e. if it is not bound to the thread and it is not created by a SmartDataSource returning shouldClose=false. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ConnectionFactoryUtils()
| Method Detail |
|---|
public static Connection getConnection(ConnectionFactory cf)
throws CannotGetCciConnectionException
Is aware of a corresponding Connection bound to the current thread, for example when using CciLocalTransactionManager. Will bind a Connection to the thread if transaction synchronization is active (e.g. if in a JTA transaction).
cf - ConnectionFactory to get Connection from
CannotGetCciConnectionException - if the attempt to get a Connection failedTransactionSynchronizationManager,
CciLocalTransactionManager
public static Connection doGetConnection(ConnectionFactory cf)
throws ResourceException
getConnection, but throwing the original ResourceException.
Is aware of a corresponding Connection bound to the current thread, for example when using DataSourceTransactionManager. Will bind a Connection to the thread if transaction synchronization is active (e.g. if in a JTA transaction).
Directly accessed by TransactionAwareDataSourceProxy.
cf - ConnectionFactory to get Connection from
ResourceException - if thrown by CCI API methodsgetConnection(ConnectionFactory),
TransactionAwareConnectionFactoryProxy
public static void releaseConnection(Connection con,
ConnectionFactory cf)
con - Connection to close if necessary
(if this is null, the call will be ignored)cf - ConnectionFactory that the Connection came from
public static void doReleaseConnection(Connection con,
ConnectionFactory cf)
throws ResourceException
releaseConnection, but throwing the original ResourceException.
Directly accessed by TransactionAwareConnectionFactoryProxy.
ResourceException - if thrown by JCA CCI methodsreleaseConnection(javax.resource.cci.Connection, javax.resource.cci.ConnectionFactory)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||