protected ArrayList filterXidsByType ( Xid [ ] xidArray ) { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "filterXidsByType" , xidArray ) ; final ArrayList < XidImpl > xidList = new ArrayList < XidImpl > ( ) ; if ( xidArray != null ) { /*----------------------------------------------------------*/ /* Iterate over the list of returned xids, and insert them */ /* into a new list containing all the xids that have been */ /* recovered thus far. We don't have to worry about */ /* duplicates because every resource is guaranteed to have a */ /* unique bqual + gtrid combination. */ /*----------------------------------------------------------*/ for ( int y = 0 ; y < xidArray . length ; y ++ ) { // PQ56777 - Oracle can return entries with null in them. // normally(?) it will be the last in the list. It // appears to happen if an indoubt transaction on the // database completes during our call to recover. if ( xidArray [ y ] == null ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "RM has returned null inDoubt Xid entry - " + y ) ; continue ; } /*------------------------------------------------------*/ /* We only want to add this Xid to our list if it is */ /* one that we generated. */ /*------------------------------------------------------*/ if ( XidImpl . isOurFormatId ( xidArray [ y ] . getFormatId ( ) ) ) { /*--------------------------------------------------*/ /* It is possible that the Xid we get back from the */ /* RM is actually an instance of our XidImpl. In */ /* the case that it's not, we have to re-construct */ /* the XidImpl so that we can extract the xid bytes. */ /*--------------------------------------------------*/ XidImpl ourXid = null ; if ( xidArray [ y ] instanceof XidImpl ) { ourXid = ( XidImpl ) xidArray [ y ] ; } else { ourXid = new XidImpl ( xidArray [ y ] ) ; // Check the bqual is one of ours... // as V5.1 also uses the same formatId but with // different length encoding if ( ourXid . getBranchQualifier ( ) . length != XidImpl . BQUAL_JTA_BQUAL_LENGTH ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Xid is wrong length - " + y ) ; continue ; } } xidList . add ( ourXid ) ; } /* if isOurFormatId() */ } /* for each Xid */ } /* if xidArray != null */ if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "filterXidsByType" , xidList ) ; return xidList ; }
Removes all non - WAS Xids from an array of Xids and puts them in an ArrayList structure .