in src/main/java/org/apache/commons/dbcp2/managed/LocalXAConnectionFactory.java [88:114]
public synchronized void commit(final Xid xid, final boolean flag) throws XAException {
Objects.requireNonNull(xid, "xid");
if (!checkCurrentXid().equals(xid)) {
throw new XAException("Invalid Xid: expected " + this.currentXid + ", but was " + xid);
}
try {
// make sure the connection isn't already closed
if (connection.isClosed()) {
throw new XAException("Connection is closed");
}
// A read only connection should not be committed
if (!connection.isReadOnly()) {
connection.commit();
}
} catch (final SQLException e) {
throw newXAException("Commit failed.", e);
} finally {
try {
connection.setAutoCommit(originalAutoCommit);
} catch (final SQLException ignored) {
// ignored
}
this.currentXid = null;
}
}