if ( Configuration.isDebugLoggingEnabled() ) Configuration.logDebug ("Calling non-transactional method '" + m.getName() + "' on connection proxy, bypassing enlistment");
return m.invoke ( wrapped_, args );
}
Object ret = null;
XAResourceTransaction restx = null;
CompositeTransaction ct = null;
CompositeTransactionManager ctm = null;
ctm = Configuration.getCompositeTransactionManager ();
boolean inTx = false;
// false if resume should be called (first invocation in tx)
if ( ctm != null )
ct = ctm.getCompositeTransaction ();
inTx = pc_.isInResourceTransaction ();
if ( ct != null && ct.getProperty ( TransactionManagerImp.JTA_PROPERTY_NAME ) != null && !pc_.isDiscarded () ) {
// only enlist if there is a NORMAL tx
// AND if the pc is not yet discarded (i.e. closed event
// without a new getConnection() event)
if ( !inTx ) {
// not yet enlisted
// IMPORTANT: we should enlist ONLY ONCE,
// since we don't have wrappers for each
// type of dependent object (statements,...)
// where the real action is
// Also, for the same reason we can only
// delist at close time, since that is the
// earliest detectable moment in time
// when all these dependent objects are no
// longer accessible.
// VITAL ASSERTION FOR THIS TO WORK:
// after close, the ResourceTransaction association
// of the pooled connection MUST be null, or the
// same restx will be reused in different
// JTA transactions!
restx = (XAResourceTransaction) resource_
.getResourceTransaction ( ct );
pc_.setResourceTransaction ( restx );
restx.resume ();
Configuration
.logDebug ( "JDBC ConnectionProxy: using resource transaction: "
+ restx.getXid () );
}
}