public abstract class JConnectionFactoryUtils
extends java.lang.Object
JConnectionFactory
. Includes special
support for Spring-managed transactional Connections, e.g. managed
by JRemoteLocalTransactionManager
or
JtaTransactionManager
.getConnection(com.jbase.jremote.JConnectionFactory)
,
releaseConnection(com.jbase.jremote.JConnection, com.jbase.jremote.JConnectionFactory)
,
JRemoteLocalTransactionManager
,
JtaTransactionManager
,
TransactionSynchronizationManager
Constructor and Description |
---|
JConnectionFactoryUtils() |
Modifier and Type | Method and Description |
---|---|
static JConnection |
getConnection(JConnectionFactory cf)
Obtain a JConnection from the given JConnectionFactory.
|
static boolean |
isConnectionTransactional(JConnection con,
JConnectionFactory cf)
Determine whether the given JRemote Connection is transactional, that is,
bound to the current thread by Spring's transaction facilities.
|
static void |
releaseConnection(JConnection con,
JConnectionFactory cf)
Close the given JConnection, obtained from the given JConnectionFactory,
if it is not managed externally (that is, not bound to the thread).
|
public static JConnection getConnection(JConnectionFactory cf) throws JRemoteException
Is aware of a corresponding Connection bound to the current thread, for example
when using JRemoteLocalTransactionManager
. 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 fromJRemoteException
- if the attempt to get a Connection failedreleaseConnection(com.jbase.jremote.JConnection, com.jbase.jremote.JConnectionFactory)
public static boolean isConnectionTransactional(JConnection con, JConnectionFactory cf)
con
- the JConnection to checkcf
- the JConnectionFactory that the JConnection was obtained from
(may be null
)public static void releaseConnection(JConnection con, JConnectionFactory 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(com.jbase.jremote.JConnectionFactory)