public abstract class ConnectionFactoryUtils extends Object
ConnectionFactory. Includes special
support for Spring-managed transactional Connections, e.g. managed
by CciLocalTransactionManager or
JtaTransactionManager.
Used internally by CciTemplate,
Spring's 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,
JtaTransactionManager,
TransactionSynchronizationManager| Constructor and Description |
|---|
ConnectionFactoryUtils() |
| Modifier and Type | Method and Description |
|---|---|
static javax.resource.cci.Connection |
doGetConnection(javax.resource.cci.ConnectionFactory cf)
Actually obtain a CCI Connection from the given ConnectionFactory.
|
static void |
doReleaseConnection(javax.resource.cci.Connection con,
javax.resource.cci.ConnectionFactory cf)
Actually close the given Connection, obtained from the given ConnectionFactory.
|
static javax.resource.cci.Connection |
getConnection(javax.resource.cci.ConnectionFactory cf)
Obtain a Connection from the given ConnectionFactory.
|
static javax.resource.cci.Connection |
getConnection(javax.resource.cci.ConnectionFactory cf,
javax.resource.cci.ConnectionSpec spec)
Obtain a Connection from the given ConnectionFactory.
|
static boolean |
isConnectionTransactional(javax.resource.cci.Connection con,
javax.resource.cci.ConnectionFactory cf)
Determine whether the given JCA CCI Connection is transactional, that is,
bound to the current thread by Spring's transaction facilities.
|
static void |
releaseConnection(javax.resource.cci.Connection con,
javax.resource.cci.ConnectionFactory cf)
Close the given Connection, obtained from the given ConnectionFactory,
if it is not managed externally (that is, not bound to the thread).
|
public static javax.resource.cci.Connection getConnection(javax.resource.cci.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 - the ConnectionFactory to obtain Connection fromCannotGetCciConnectionException - if the attempt to get a Connection failedreleaseConnection(javax.resource.cci.Connection, javax.resource.cci.ConnectionFactory)public static javax.resource.cci.Connection getConnection(javax.resource.cci.ConnectionFactory cf,
javax.resource.cci.ConnectionSpec spec)
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 - the ConnectionFactory to obtain Connection fromspec - the ConnectionSpec for the desired Connection (may be null).
Note: If this is specified, a new Connection will be obtained for every call,
without participating in a shared transactional Connection.CannotGetCciConnectionException - if the attempt to get a Connection failedreleaseConnection(javax.resource.cci.Connection, javax.resource.cci.ConnectionFactory)public static javax.resource.cci.Connection doGetConnection(javax.resource.cci.ConnectionFactory cf)
throws javax.resource.ResourceException
getConnection(javax.resource.cci.ConnectionFactory), but throwing the original ResourceException.
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).
Directly accessed by TransactionAwareConnectionFactoryProxy.
cf - the ConnectionFactory to obtain Connection fromjavax.resource.ResourceException - if thrown by CCI API methodsdoReleaseConnection(javax.resource.cci.Connection, javax.resource.cci.ConnectionFactory)public static boolean isConnectionTransactional(javax.resource.cci.Connection con,
javax.resource.cci.ConnectionFactory cf)
con - the Connection to checkcf - the ConnectionFactory that the Connection was obtained from
(may be null)public static void releaseConnection(javax.resource.cci.Connection con,
javax.resource.cci.ConnectionFactory cf)
con - the Connection to close if necessary
(if this is null, the call will be ignored)cf - the ConnectionFactory that the Connection was obtained from
(can be null)getConnection(javax.resource.cci.ConnectionFactory)public static void doReleaseConnection(javax.resource.cci.Connection con,
javax.resource.cci.ConnectionFactory cf)
throws javax.resource.ResourceException
releaseConnection(javax.resource.cci.Connection, javax.resource.cci.ConnectionFactory), but throwing the original ResourceException.
Directly accessed by TransactionAwareConnectionFactoryProxy.
con - the Connection to close if necessary
(if this is null, the call will be ignored)cf - the ConnectionFactory that the Connection was obtained from
(can be null)javax.resource.ResourceException - if thrown by JCA CCI methodsdoGetConnection(javax.resource.cci.ConnectionFactory)Copyright © 2015. All rights reserved.