in src/main/java/org/apache/commons/dbcp2/managed/LocalXAConnectionFactory.java [285:313]
public synchronized void start(final Xid xid, final int flag) throws XAException {
if (flag == TMNOFLAGS) {
// first time in this transaction
// make sure we aren't already in another tx
if (this.currentXid != null) {
throw new XAException("Already enlisted in another transaction with xid " + xid);
}
// save off the current auto commit flag, so it can be restored after the transaction completes
try {
originalAutoCommit = connection.getAutoCommit();
} catch (final SQLException ignored) {
// no big deal, just assume it was off
originalAutoCommit = true;
}
// update the auto commit flag
try {
connection.setAutoCommit(false);
} catch (final SQLException e) {
throw newXAException("Count not turn off auto commit for a XA transaction", e);
}
this.currentXid = xid;
} else if (flag == TMRESUME) {
if (!xid.equals(this.currentXid)) {
throw new XAException("Attempting to resume in different transaction: expected " + this.currentXid + ", but was " + xid);
}
} else {
throw new XAException("Unknown start flag " + flag);
}
}