|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.jca.cci.connection.ConnectionFactoryUtils
public abstract class ConnectionFactoryUtils
Helper class that provides static methods for obtaining CCI Connections from
a ConnectionFactory
. Has special support for
Spring-managed Connections, e.g. for use with 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 Summary | |
---|---|
ConnectionFactoryUtils()
|
Method Summary | |
---|---|
static Connection |
doGetConnection(ConnectionFactory cf)
Actually obtain a CCI Connection from the given ConnectionFactory. |
static void |
doReleaseConnection(Connection con,
ConnectionFactory cf)
Actually close the given Connection, obtained from the given ConnectionFactory. |
static Connection |
getConnection(ConnectionFactory cf)
Obtain a Connection from the given ConnectionFactory. |
static void |
releaseConnection(Connection con,
ConnectionFactory cf)
Close the given Connection, obtained from the given ConnectionFactory, if it is not managed externally (that is, not bound to the thread). |
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
- the ConnectionFactory to obtain Connection from
CannotGetCciConnectionException
- if the attempt to get a Connection failedreleaseConnection(javax.resource.cci.Connection, javax.resource.cci.ConnectionFactory)
public static Connection doGetConnection(ConnectionFactory cf) throws 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 from
ResourceException
- if thrown by CCI API methodsdoReleaseConnection(javax.resource.cci.Connection, javax.resource.cci.ConnectionFactory)
public static void releaseConnection(Connection con, 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(Connection con, ConnectionFactory cf) throws 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
)
ResourceException
- if thrown by JCA CCI methodsdoGetConnection(javax.resource.cci.ConnectionFactory)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |