gtpc2m9vC/C++ Language Support User's Guide

xa_end-End Work Performed for a Transaction Branch

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

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