// so we must do so directly. start may fail due to dupl xid or other reason, and transactions
// may rollback async, for which reasons we can't call add before start.
// The xid will change on each pass of the loop, so we need to create a new record on each pass.
// The creation will fail in the case of multiple last resources being disallowed, in which
// case we don't call start on the resource at all. see JBTM-362 and JBTM-363
XAResourceRecord xaResourceRecord = createRecord(xaRes, params, xid);
if(xaResourceRecord != null) {
xaRes.start(xid, XAResource.TMNOFLAGS);
try {
RecoveryCoordinator recCoord = _theTransaction.registerResource(xaResourceRecord.getResource());
xaResourceRecord.setRecoveryCoordinator(recCoord);
} catch(Exception e) {
// we called start on the resource, but _theTransaction did not accept it.
// we therefore have a mess which we must now clean up by ensuring the start is undone:
xaResourceRecord.rollback();
markRollbackOnly();
return false;
}
_resources.put(xaRes, new TxInfo(xid));
return true; // dive out, no need to set associatedWork = true;