protected boolean delistResource ( XAResource xaRes , int flag ) throws SystemException { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "delistResource" , new Object [ ] { xaRes , Util . printFlag ( flag ) } ) ; // get resource manager instance JTAResourceBase jtaRes = ( JTAResourceBase ) getResourceTable ( ) . get ( xaRes ) ; if ( jtaRes == null && _onePhaseResourceEnlisted != null ) { if ( _onePhaseResourceEnlisted . XAResource ( ) . equals ( xaRes ) ) jtaRes = _onePhaseResourceEnlisted ; } if ( jtaRes == null ) { Tr . error ( tc , "WTRN0065_XARESOURCE_NOT_KNOWN" , xaRes ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "delistResource" , Boolean . FALSE ) ; return false ; } // try to end transaction association using specified flag. try { jtaRes . end ( flag ) ; } catch ( XAException xae ) { _errorCode = xae . errorCode ; // Save locally for FFDC FFDCFilter . processException ( xae , "com.ibm.tx.jta.impl.RegisteredResources.delistResource" , "711" , this ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "XAException: error code " + XAReturnCodeHelper . convertXACode ( _errorCode ) , xae ) ; Throwable toThrow = null ; if ( _errorCode >= XAException . XA_RBBASE && _errorCode <= XAException . XA_RBEND ) { if ( tc . isEventEnabled ( ) ) Tr . event ( tc , "Transaction branch has been marked rollback-only by the RM" ) ; } else if ( _errorCode == XAException . XAER_RMFAIL ) { if ( tc . isEventEnabled ( ) ) Tr . event ( tc , "RM has failed" ) ; // Resource has rolled back jtaRes . setResourceStatus ( StatefulResource . ROLLEDBACK ) ; jtaRes . destroy ( ) ; } else // XAER_RMERR, XAER_INVAL, XAER_PROTO, XAER_NOTA { Tr . error ( tc , "WTRN0079_END_FAILED" , new Object [ ] { XAReturnCodeHelper . convertXACode ( _errorCode ) , xae } ) ; toThrow = new SystemException ( "XAResource end association error:" + XAReturnCodeHelper . convertXACode ( _errorCode ) ) . initCause ( xae ) ; } // Mark transaction as rollback only. try { _transaction . setRollbackOnly ( ) ; if ( tc . isEventEnabled ( ) ) Tr . event ( tc , "Transaction marked as rollback only." ) ; } catch ( IllegalStateException e ) { FFDCFilter . processException ( e , "com.ibm.tx.jta.impl.RegisteredResources.delistResource" , "742" , this ) ; toThrow = new SystemException ( e . getLocalizedMessage ( ) ) . initCause ( e ) ; } if ( toThrow != null ) { if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "delistResource" , toThrow ) ; throw ( SystemException ) toThrow ; } } if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "delistResource" , Boolean . TRUE ) ; return true ; }
Delist the specified resource from the transaction .