gtpc2m9u | C/C++ Language Support User's Guide |
The transaction manager (TM) calls the xa_commit function to
commit work associated with the transaction branch. Any changes made to
resources held during the transaction branch are made permanent.
Format
#include (i$tmcr.h)
int xa_commit(XID *xid, int rmid, long flags);
- xid
- A pointer to an exchange identification (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
-
- TMNOFLAGS
- Used when no other flags are set.
Normal Return
- XA_OK
- Normal completion.
Error Return
- XA_RBROLLBACK
- The resource manager (RM) did not commit the work done for the transaction
branch. The resource manager has rolled back the work of the branch and
has released all held resources.
- XAER_RMERR
- An error occurred in committing the work performed for the transaction
branch and the work of the branch has been rolled back. This error
signals a catastrophic event to a transaction manager because other resource
managers may successfully commit their work for this branch. This error
is returned only when a resource manager concludes that it can never commit
the branch and that it cannot hold the resource of the branch in a prepared
state.
- 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.
- All transaction branches must have been ended by using the
xa_end() function with the TMSUCCESS flag.
- A transaction manager must issue a separate xa_commit function
for each transaction branch that accesses the resource manager.
- From the perspective of the resource managers, pointer xid is
valid only for the duration of the call to the xa_commit()
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_commit(XID *xid, int rmid, long flags) != XA_OK)
{
/* handle error condition */
·
·
·
}
else {
/* continue with normal processing */
·
·
·
}
Related Information