// Enlist XAResource if we are actually in a transaction
if (tx != null) {
if (mc.getOpenCount() == 1) { // Only if first/only thread
try {
this.logger.debug("enlist XAResource on {0}", tx);
tx.enlistResource(mc.getXAResource());
ret.setAutoCommit(false);
} catch (RollbackException e) {
// Although tx has been marked to be rolled back,
// XAResource has been correctly enlisted.
this.logger.warn("XAResource enlisted, but tx is marked rollback", e);