public Xid[] recover(int flag) throws XAException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.entry(this, tc, "recover", ivManagedConnection, AdapterUtil.getXAResourceRecoverFlagString(flag));
        // if the MC marked Stale, it means the user requested a purge pool with an immediate option
        // so don't allow any work to continue.  In this case, we throw XAER_RMFAIL xa error
        // which indicates that the resource manager is not available
        if (ivManagedConnection._mcStale) {
            Tr.error(tc, "INVALID_CONNECTION");
            XAException x = new XAException(XAException.XAER_RMFAIL);
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
                Tr.exit(this, tc, "recover", new Object[] { "MC is stale throwing XAER_RMFAIL", ivManagedConnection });
            throw x;
        }

        Xid[] xids = null;

        try {
            xids = ivXaRes.recover(flag);
            if (xids == null || xids.length == 0) 
            { 
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) 
                    Tr.event(this, tc, "No oustanding transactions to recover.  Transaction state does not change.");
            } else {
                ivStateManager.setState(WSStateManager.XA_RECOVER);
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) 
                    Tr.event(this, tc, "Outstanding transactions to recover.  Transaction state is changing to " +
                                       ivManagedConnection.getTransactionStateAsString());
            }
        } catch (TransactionException te) {
            FFDCFilter.processException(te, "com.ibm.ws.rsadapter.spi.WSRdbXaResourceImpl.recover", "438", this);
            Tr.warning(tc, "DSA_INTERNAL_WARNING", new Object[] { "Exception setting the transaction state to WSStateManager.XA_RECOVER from ",
                                                                 ivManagedConnection.getTransactionStateAsString(), te });
            //should never happen so just eat it
        } catch (XAException xae) {
            FFDCFilter.processException(xae, "com.ibm.ws.rsadapter.spi.WSRdbXaResourceImpl.recover", "444", this);
            traceXAException(xae, currClass);
            checkXAException(xae); 
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                Tr.exit(this, tc, "recover", "Exception");
            throw xae;
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.exit(this, tc, "recover", xids);
        return xids;
    }
public Xid [ ] recover ( int flag ) throws XAException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "recover" , ivManagedConnection , AdapterUtil . getXAResourceRecoverFlagString ( flag ) ) ; if ( ivManagedConnection . _mcStale ) { Tr . error ( tc , "INVALID_CONNECTION" ) ; XAException x = new XAException ( XAException . XAER_RMFAIL ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "recover" , new Object [ ] { "MC is stale throwing XAER_RMFAIL" , ivManagedConnection } ) ; throw x ; } Xid [ ] xids = null ; try { xids = ivXaRes . recover ( flag ) ; if ( xids == null || xids . length == 0 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) Tr . event ( this , tc , "No oustanding transactions to recover.  Transaction state does not change." ) ; } else { ivStateManager . setState ( WSStateManager . XA_RECOVER ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) Tr . event ( this , tc , "Outstanding transactions to recover.  Transaction state is changing to " + ivManagedConnection . getTransactionStateAsString ( ) ) ; } } catch ( TransactionException te ) { FFDCFilter . processException ( te , "com.ibm.ws.rsadapter.spi.WSRdbXaResourceImpl.recover" , "438" , this ) ; Tr . warning ( tc , "DSA_INTERNAL_WARNING" , new Object [ ] { "Exception setting the transaction state to WSStateManager.XA_RECOVER from " , ivManagedConnection . getTransactionStateAsString ( ) , te } ) ; } catch ( XAException xae ) { FFDCFilter . processException ( xae , "com.ibm.ws.rsadapter.spi.WSRdbXaResourceImpl.recover" , "444" , this ) ; traceXAException ( xae , currClass ) ; checkXAException ( xae ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "recover" , "Exception" ) ; throw xae ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "recover" , xids ) ; return xids ; }
Obtain a list of prepared transaction branches from a resource manager. The transaction manager calls this method during
recovery to obtain the list of transaction branches that are currently in prepared or heuristically completed states.

@param int flag - One of TMSTARTRSCAN, TMENDRSCAN, TMNOFLAGS. TMNOFLAGS must be used when no other flags
are set in flags.
@return Xid[] - The resource manager returns zero or more XIDs for the transaction branches that are currently in a prepared or
heuristically completed state. If an error occurs during the operation, the resource manager should throw the appropriate
XAException.
@exception XAException - An error has occurred. Possible values are XAER_RMERR, XAER_RMFAIL, XAER_INVAL, and
XAER_PROTO.