JBTM-1786 changed the XAResourceRecord::topLevelAbort such that the flag we send to XAR::end() from TMSUCCESS to TMFAIL.
It is possible that when we call XAResource::end(TMFAIL) the branch may have been:
1. marked as rollback only
2. rolled back
From the XA spec: "The portion of work has failed. A resource manager might choose to mark a transaction branch as rollback-only at this point. In fact, a transaction manager does so for the global transaction. If a resource manager chooses to do so also, xa_end() returns one of the [XA_RB∗] values. TMFAIL cannot be used in conjunction with either TMSUSPEND or TMSUCCESS."
We cannot rely on the resource manager having rolled back the branch so we have to call XAR::rollback. An example is DB2, in this case it has rolled back the branch and so can raise an XAException when we call rollback on it.
We should record if the RM has returned an XA_RBROLLBACK during end and if the RM then returns XAER_RMFAIL during rollback we should downgrade the logging to debug level.