@Override
    public void end(Xid xid, int flags) throws XAException {

        final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled();

        if (isTracingEnabled && tc.isEntryEnabled())
            Tr.entry(this, tc, "end");

        if (getMcWrapper().isMCAborted()) {
            Tr.exit(tc, "Connection was aborted. Exiting end.");
            return;
        }

        try {
            xaResource.end(xid, flags);
        } catch (XAException e) {
            processXAException(e);
            if (flags == XAResource.TMFAIL && ((e.errorCode >= XAException.XA_RBBASE) && (e.errorCode <= XAException.XA_RBEND))) {
                // okay error codes for the rollback processing.
            } else {
                com.ibm.ws.ffdc.FFDCFilter.processException(
                                                            e,
                                                            "com.ibm.ejs.j2c.XATransactionWrapper.end",
                                                            "417",
                                                            this);
                if (!mcWrapper.isStale()) {
                    Tr.error(tc, "XA_RESOURCE_ADAPTER_OPERATION_ID_EXCP_J2CA0027", "end", xid, e, mcWrapper.gConfigProps.cfName);
                }
                if (isTracingEnabled && tc.isEntryEnabled())
                    Tr.exit(this, tc, "end", e);
                throw e;
            }
        } catch (Exception e) {
            com.ibm.ws.ffdc.FFDCFilter.processException(
                                                        e,
                                                        "com.ibm.ejs.j2c.XATransactionWrapper.end",
                                                        "423",
                                                        this);
            if (!mcWrapper.shouldBeDestroyed()) {
                mcWrapper.markTransactionError();
                Tr.error(tc, "XA_RESOURCE_ADAPTER_OPERATION_ID_EXCP_J2CA0027", "end", xid, e, mcWrapper.gConfigProps.cfName);
            }
            XAException xae = new XAException(XAException.XAER_RMFAIL);
            xae.initCause(e);
            if (isTracingEnabled && tc.isEntryEnabled())
                Tr.exit(this, tc, "end", xae);
            throw xae;
        }

        if (isTracingEnabled && tc.isEntryEnabled())
            Tr.exit(this, tc, "end");
    }
@ Override public void end ( Xid xid , int flags ) throws XAException { final boolean isTracingEnabled = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTracingEnabled && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "end" ) ; if ( getMcWrapper ( ) . isMCAborted ( ) ) { Tr . exit ( tc , "Connection was aborted. Exiting end." ) ; return ; } try { xaResource . end ( xid , flags ) ; } catch ( XAException e ) { processXAException ( e ) ; if ( flags == XAResource . TMFAIL && ( ( e . errorCode >= XAException . XA_RBBASE ) && ( e . errorCode <= XAException . XA_RBEND ) ) ) { } else { com . ibm . ws . ffdc . FFDCFilter . processException ( e , "com.ibm.ejs.j2c.XATransactionWrapper.end" , "417" , this ) ; if ( ! mcWrapper . isStale ( ) ) { Tr . error ( tc , "XA_RESOURCE_ADAPTER_OPERATION_ID_EXCP_J2CA0027" , "end" , xid , e , mcWrapper . gConfigProps . cfName ) ; } if ( isTracingEnabled && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "end" , e ) ; throw e ; } } catch ( Exception e ) { com . ibm . ws . ffdc . FFDCFilter . processException ( e , "com.ibm.ejs.j2c.XATransactionWrapper.end" , "423" , this ) ; if ( ! mcWrapper . shouldBeDestroyed ( ) ) { mcWrapper . markTransactionError ( ) ; Tr . error ( tc , "XA_RESOURCE_ADAPTER_OPERATION_ID_EXCP_J2CA0027" , "end" , xid , e , mcWrapper . gConfigProps . cfName ) ; } XAException xae = new XAException ( XAException . XAER_RMFAIL ) ; xae . initCause ( e ) ; if ( isTracingEnabled && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "end" , xae ) ; throw xae ; } if ( isTracingEnabled && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "end" ) ; }
Ends the work performed on behalf of a transaction branch. The resource manager disassociates the XA resource from the transaction branch specified and let the transaction
be completed.

<P>If TMSUSPEND is specified in flags, the transaction branch is temporarily suspended in incomplete state. The transaction context is in suspened state and must be resumed
via start with TMRESUME specified.

<P>If TMFAIL is specified, the portion of work has failed. The resource manager may mark the transaction as rollback-only

<P>If TMSUCCESS is specified, the portion of work has completed successfully.

@param xid A global transaction identifier that is the same as what was used previously in the start method.
@param flags One of TMSUCCESS, TMFAIL, or TMSUSPEND.

@throws XAException An error has occurred. Possible XAException values are XAER_RMERR, XAER_RMFAILED, XAER_NOTA, XAER_INVAL, XAER_PROTO, or XA_RB*.