gtpc2m9v | C/C++ Language Support User's Guide |
The transaction manager (TM) calls the xa_end function when an
entry control block (ECB) is completed, or needs to suspend work on, a
transaction branch. When the xa_end() function successfully
returns, the calling ECB is no longer actively associated with the branch, but
the branch still exists.
A resource manager (RM) will mark the transaction branch as rollback-only
and return XA_RBROLLBACK if the TMFAIL flag is set.
Format
#include (i$tmcr.h)
int xa_end(XID *xid, int rmid, long flags);
- xid
- A pointer to an XID structure. XID is a unique identifier assigned
by the transaction manager for each transaction branch.
- rmid
- An integer, assigned by the TM, that can be used to uniquely identify the
called resource manager instance.
- flags
-
- TMSUSPEND
- Used by the tx_suspend_tpf function.
- TMSUCCESS
- A resource manager has not returned XA_RBROLLBACK on any previous XA
function calls for this transaction branch.
- TMFAIL
- A resource manager has returned XA_RBROLLBACK on previous XA function
calls for this transaction branch.
Normal Return
- XA_OK
- Normal completion.
Error Return
- XA_RBROLLBACK
- The resource manager has disassociated the transaction branch from the
thread of control and has marked as rollback-only the work performed for the
transaction branch.
- XAER_RMERR
- An error occurred in disassociating the transaction branch from the thread
of control.
- XAER_RMFAIL
- An error occurred that makes the resource manager unavailable.
- 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 resource manager's perspective, the pointer xid
is valid only for the duration of the call to the xa_end()
function. That is, once the function completes, 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_end(XID *xid, int rmid, long flags) != XA_OK)
{
/* handle error condition */
·
·
·
}
else {
/* continue with normal processing */
·
·
·
}
Related Information