// Comment out following debug statement before public release:
/*
System.err.println("STARTING NEW Xid: " + xid);
*/
if (state != XA_STATE_INITIAL && state != XA_STATE_DISPOSED) {
throw new XAException("Invalid XAResource state");
}
if (xaDataSource == null) {
throw new XAException(
"JDBCXAResource has not been associated with a XADataSource");
}
if (xid == null) {
// This block asserts that all JDBCXAResources with state
// >= XA_STATE_STARTED have a non-null xid.
throw new XAException("Null Xid");
}
try {
originalAutoCommitMode = connection.getAutoCommit(); // real/phys.
connection.setAutoCommit(false); // real/phys.
} catch (SQLException se) {
throw new XAException(se.getMessage());
}
this.xid = xid;
state = XA_STATE_STARTED;