[jboss-svn-commits] JBL Code SVN: r28938 - labs/jbosstm/branches/JBOSSTS_4_2_3_GA_SP/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/recovery/arjunacore.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Aug 14 12:16:26 EDT 2009
Author: jhalliday
Date: 2009-08-14 12:16:25 -0400 (Fri, 14 Aug 2009)
New Revision: 28938
Modified:
labs/jbosstm/branches/JBOSSTS_4_2_3_GA_SP/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/recovery/arjunacore/RecoveryXids.java
labs/jbosstm/branches/JBOSSTS_4_2_3_GA_SP/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/recovery/arjunacore/XARecoveryModule.java
Log:
Port 'XA recovery fails to span XAResources' fix to 4.2.3.SP branch. JBTM-602
Modified: labs/jbosstm/branches/JBOSSTS_4_2_3_GA_SP/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/recovery/arjunacore/RecoveryXids.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_2_3_GA_SP/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/recovery/arjunacore/RecoveryXids.java 2009-08-14 14:48:51 UTC (rev 28937)
+++ labs/jbosstm/branches/JBOSSTS_4_2_3_GA_SP/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/recovery/arjunacore/RecoveryXids.java 2009-08-14 16:16:25 UTC (rev 28938)
@@ -178,6 +178,30 @@
return false;
}
+ /**
+ * If supplied xids contains any values seen on prev scans, replace the existing
+ * XAResource with the supplied one and return true. Otherwise, return false.
+ *
+ * @param xaResource
+ * @param xids
+ * @return
+ */
+ public boolean updateIfEquivalentRM(XAResource xaResource, Xid[] xids)
+ {
+ if(xids == null || xids.length == 0) {
+ return false;
+ }
+
+ for(int i = 0; i < xids.length; i++) {
+ if(contains(xids[i])) {
+ _xares = xaResource;
+ return true;
+ }
+ }
+
+ return false;
+ }
+
private Xid[] _scanN;
private Xid[] _scanM;
private XAResource _xares;
Modified: labs/jbosstm/branches/JBOSSTS_4_2_3_GA_SP/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/recovery/arjunacore/XARecoveryModule.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_2_3_GA_SP/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/recovery/arjunacore/XARecoveryModule.java 2009-08-14 14:48:51 UTC (rev 28937)
+++ labs/jbosstm/branches/JBOSSTS_4_2_3_GA_SP/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/recovery/arjunacore/XARecoveryModule.java 2009-08-14 16:16:25 UTC (rev 28938)
@@ -782,6 +782,8 @@
if (_xidScans == null) _xidScans = new Hashtable();
else
{
+ refreshXidScansForEquivalentXAResourceImpl(xares, trans);
+
xidsToRecover = (RecoveryXids) _xidScans.get(xares);
if (xidsToRecover == null)
@@ -1116,6 +1118,39 @@
return true;
}
+ /**
+ * For some drivers, isSameRM is connection specific. If we have prev scan results
+ * for the same RM but using a different connection, we need to be able to identify them.
+ * Look at the data from previous scans, identify any for the same RM but different XAResource
+ * by checking for matching Xids, then replace the old XAResource with the supplied one.
+ *
+ * @param xares
+ * @param xids
+ */
+ private void refreshXidScansForEquivalentXAResourceImpl(XAResource xares, Xid[] xids)
+ {
+ if(xids == null || xids.length == 0) {
+ return;
+ }
+
+ Enumeration keys = _xidScans.keys();
+
+ while (keys.hasMoreElements())
+ {
+ XAResource theKey = (XAResource) keys.nextElement();
+ RecoveryXids recoveryXids = (RecoveryXids) _xidScans.get(theKey);
+
+ if(recoveryXids.updateIfEquivalentRM(xares, xids)) {
+ // recoveryXids is for this xares, but was originally obtained using
+ // a different XAResource. rekey the hashtable to use the new one.
+ _xidScans.remove(theKey);
+ theKey = xares;
+ _xidScans.put(theKey, recoveryXids);
+ break;
+ }
+ }
+ }
+
/**
* Is there a log file for this transaction?
*
More information about the jboss-svn-commits
mailing list