@Override
    public boolean enlistResource(XAResource xaRes) throws RollbackException, IllegalStateException, SystemException {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "enlistResource (SPI)", xaRes);

        //
        // Check the transaction is in a valid state to allow a new resource to be enlisted.
        //
        switch (_status.getState()) {
            case TransactionState.STATE_ACTIVE: {
                if (!_timedOut)
                    break;
            }
            case TransactionState.STATE_ROLLED_BACK:
            case TransactionState.STATE_ROLLING_BACK:
            case TransactionState.STATE_HEURISTIC_ON_ROLLBACK: {
                RollbackException rbe = new RollbackException("Transaction rolled back");
                FFDCFilter.processException(rbe, "com.ibm.tx.jta.TransactionImpl.enlistResource", "1760", this);
                if (tc.isEntryEnabled())
                    Tr.exit(tc, "enlistResource (SPI)", rbe);
                throw rbe;
            }
            default: {
                //
                // We do NOT allow enlistResource during preparing state.
                //
                final IllegalStateException ise = new IllegalStateException("Transaction is inactive or prepared");
                FFDCFilter.processException(ise, "com.ibm.tx.jta.TransactionImpl.enlistResource", "1769", this);
                if (tc.isEntryEnabled())
                    Tr.exit(tc, "enlistResource (SPI)", ise);
                throw ise;
            }
        }

        if (xaRes == null) {
            final IllegalStateException ise = new IllegalStateException("Cannot enlist a null resource");
            if (tc.isEntryEnabled())
                Tr.exit(tc, "enlistResource", ise);
            throw ise;
        }

        try {
            if (xaRes instanceof OnePhaseXAResource) {
                getResources().enlistResource(xaRes);
            } else {

                final int recoveryId = TransactionManagerFactory.getTransactionManager().registerResourceInfo("unused", new DirectEnlistXAResourceInfo(xaRes));
                enlistResource(xaRes, recoveryId);
            }
        } catch (IllegalStateException ise) {
            FFDCFilter.processException(ise, "com.ibm.tx.jta.TransactionImpl.enlistResource", "1858", this);
            if (tc.isEntryEnabled())
                Tr.exit(tc, "enlistResource (SPI)", ise);
            throw ise;
        } catch (Throwable t) {
            FFDCFilter.processException(t, "com.ibm.tx.jta.TransactionImpl.enlistResource", "1868", this);
            this.setRollbackOnly();
            final RollbackException rbe = new RollbackException(t.getMessage());
            rbe.initCause(t);
            if (tc.isEntryEnabled())
                Tr.exit(tc, "enlistResource (SPI)", rbe);
            throw rbe;
        }

        if (tc.isEntryEnabled())
            Tr.exit(tc, "enlistResource (SPI)", Boolean.TRUE);
        return true;
    }
@ Override public boolean enlistResource ( XAResource xaRes ) throws RollbackException , IllegalStateException , SystemException { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "enlistResource (SPI)" , xaRes ) ; switch ( _status . getState ( ) ) { case TransactionState . STATE_ACTIVE : { if ( ! _timedOut ) break ; } case TransactionState . STATE_ROLLED_BACK : case TransactionState . STATE_ROLLING_BACK : case TransactionState . STATE_HEURISTIC_ON_ROLLBACK : { RollbackException rbe = new RollbackException ( "Transaction rolled back" ) ; FFDCFilter . processException ( rbe , "com.ibm.tx.jta.TransactionImpl.enlistResource" , "1760" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "enlistResource (SPI)" , rbe ) ; throw rbe ; } default : { final IllegalStateException ise = new IllegalStateException ( "Transaction is inactive or prepared" ) ; FFDCFilter . processException ( ise , "com.ibm.tx.jta.TransactionImpl.enlistResource" , "1769" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "enlistResource (SPI)" , ise ) ; throw ise ; } } if ( xaRes == null ) { final IllegalStateException ise = new IllegalStateException ( "Cannot enlist a null resource" ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "enlistResource" , ise ) ; throw ise ; } try { if ( xaRes instanceof OnePhaseXAResource ) { getResources ( ) . enlistResource ( xaRes ) ; } else { final int recoveryId = TransactionManagerFactory . getTransactionManager ( ) . registerResourceInfo ( "unused" , new DirectEnlistXAResourceInfo ( xaRes ) ) ; enlistResource ( xaRes , recoveryId ) ; } } catch ( IllegalStateException ise ) { FFDCFilter . processException ( ise , "com.ibm.tx.jta.TransactionImpl.enlistResource" , "1858" , this ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "enlistResource (SPI)" , ise ) ; throw ise ; } catch ( Throwable t ) { FFDCFilter . processException ( t , "com.ibm.tx.jta.TransactionImpl.enlistResource" , "1868" , this ) ; this . setRollbackOnly ( ) ; final RollbackException rbe = new RollbackException ( t . getMessage ( ) ) ; rbe . initCause ( t ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "enlistResource (SPI)" , rbe ) ; throw rbe ; } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "enlistResource (SPI)" , Boolean . TRUE ) ; return true ; }
Enlist the resouce with the transaction associated with the target
TransactionImpl object.

This is the default version of the method and does not take in the
XA resource class name or info objects required during recovery.
This means that the resource cannot be logged or recovered and so
cannot be a two phase capable resource. Only one phase capable
resources may be enlisted by this method. We prevent registration
of two phase capable resources by throwing an exception.

This method defers to the implementation version of the method
and passes null fields for the recovery parameters.

The intention is that that this method should be used as little
as possible. Future calls should only be made directly to the
implementation version of this method, passing null recovery
information when registering a one phase capable resource.

@return <i>true</i> if the resource was enlisted successfully; otherwise <i>false</i>.

@param xaRes the XAResource object associated with XAConnection

@exception RollbackException
@exception IllegalStateException
@exception SystemException