[jboss-svn-commits] JBL Code SVN: r36579 - labs/jbosstm/branches/JBOSSTS_4_6_1_GA_CP/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/recovery/arjunacore.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Jan 27 04:56:00 EST 2011


Author: jhalliday
Date: 2011-01-27 04:55:59 -0500 (Thu, 27 Jan 2011)
New Revision: 36579

Modified:
   labs/jbosstm/branches/JBOSSTS_4_6_1_GA_CP/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/recovery/arjunacore/RecoveryXids.java
Log:
Fix Xid recovery scanning. JBTM-823


Modified: labs/jbosstm/branches/JBOSSTS_4_6_1_GA_CP/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/recovery/arjunacore/RecoveryXids.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_6_1_GA_CP/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/recovery/arjunacore/RecoveryXids.java	2011-01-26 14:07:18 UTC (rev 36578)
+++ labs/jbosstm/branches/JBOSSTS_4_6_1_GA_CP/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/recovery/arjunacore/RecoveryXids.java	2011-01-27 09:55:59 UTC (rev 36579)
@@ -121,23 +121,33 @@
         final int numScanN = (_scanN == null ? 0 : _scanN.length) ;
         final int numScanM = (_scanM == null ? 0 : _scanM.length) ;
         final int numScan = Math.min(numScanN, numScanM) ;
-        
+
         if (numScan == 0)
         {
             return null ;
         }
-        
-        final Vector workingVector = new Vector() ;
-        
-        for (int count = 0 ; count < numScan ; count++)
+
+        final List<Xid> workingList = new ArrayList<Xid>(numScanN) ;
+
+        for(int i = 0; i < numScanN; i++)
         {
-            if (XAHelper.sameXID(_scanN[count], _scanM[count]))
+            // JBTM-823 / JBPAPP-5195 : don't assume list order/content match.
+            // the list is (hopefully) small and we don't entirely trust 3rd party
+            // Xid hashcode behaviour, so we just do this the brute force way...
+            for(int j = 0; j < numScanM; j++)
             {
-                workingVector.add(_scanN[count]);
+                if (XAHelper.sameXID(_scanN[i], _scanM[j]))
+                {
+                    workingList.add(_scanN[i]);
+                    // any given id should be in _scanN only once, but _scanM may have dupls as
+                    // it's actually a combination of prev runs, per the array copy in nextScan.
+                    // we drop out here as we want each Xid only once in the return set:
+                    break;
+                }
             }
         }
-        
-        return workingVector.toArray();
+
+        return workingList.toArray(new Xid[workingList.size()]);
     }
 
     public final boolean isSameRM (XAResource xares)



More information about the jboss-svn-commits mailing list