gtpc2m9z | C/C++ Language Support User's Guide |
The transaction manager (TM) calls the xa_rollback function to
roll back the work performed at a resource manager for the transaction
branch. Any resources held by the resource manager (RM) for the branch
are released, and those that have been modified are restored to their value at
the start of the branch.
Format
#include (i$tmcr.h)
int xa_rollback(XID *xid, int rmid, long flags);
- xid
- A pointer to an exchange identification (XID)structure.
xid is a unique identifier assigned by the TM for each transaction
branch.
- rmid
- An integer, assigned by the TM, that can be used to uniquely identify the
called RM instance.
- flags
-
- TMNOFLAGS
- The only value supported.
Normal Return
- XA_OK
- Normal completion.
Error Return
- XA_RBROLLBACK
- The resource manager has rolled back the work of the transaction branch
and has released all held resources. This value is returned when the
branch was already marked rollback-only.
- XAER_RMERR
- An error occurred when rolling back the transaction branch. The
transaction branch is corrupted when returning this error.
- XAER_RMFAIL
- An error occurred that makes the resource manager unavailable. The
specified xid may or may not have been prepared.
- XAER_NOTA
- The specified xid is not known by the resource manager.
- XAER_INVAL
- Incorrect arguments were specified.
- XAER_PROTO
- The routine was called incorrectly.
Programming Considerations
- You must have authorization to issue a restricted C function.
- From the perspective of the resource manager, the pointer xid
is valid only for the duration of the call to the xa_rollback()
function; that is, once the function ends, the transaction manager is
permitted to invalidate where xid points. Resource managers
are encouraged to use private copies of *xid after the
function ends.
Examples
#include (i$tmcr.h)
if (xa_rollback(XID *xid, int rmid, long flags) != XA_OK)
{
/* handle error condition */
·
·
·
}
else {
/* continue with normal processing */
·
·
·
}
Related Information