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

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Oct 17 09:49:58 EDT 2011


Author: tomjenkinson
Date: 2011-10-17 09:49:58 -0400 (Mon, 17 Oct 2011)
New Revision: 37574

Added:
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/recovery/arjunacore/SubordinateJTAXAResourceOrphanFilter.java
Removed:
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/recovery/arjunacore/SubordinateJTANodeNameXAResourceOrphanFilter.java
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/recovery/arjunacore/SubordinateJTATransactionLogXAResourceOrphanFilter.java
Log:
JBTM-917 updated to convert to a single OrphanFilter for subordinates

Deleted: labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/recovery/arjunacore/SubordinateJTANodeNameXAResourceOrphanFilter.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/recovery/arjunacore/SubordinateJTANodeNameXAResourceOrphanFilter.java	2011-10-17 13:26:50 UTC (rev 37573)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/recovery/arjunacore/SubordinateJTANodeNameXAResourceOrphanFilter.java	2011-10-17 13:49:58 UTC (rev 37574)
@@ -1,77 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and/or its affiliates,
- * and individual contributors as indicated by the @author tags.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- *
- * (C) 2010,
- * @author JBoss, by Red Hat.
- */
-package com.arjuna.ats.internal.jta.recovery.arjunacore;
-
-
-import com.arjuna.ats.internal.jta.utils.XAUtils;
-import com.arjuna.ats.jta.common.jtaPropertyManager;
-import com.arjuna.ats.jta.logging.jtaLogger;
-import com.arjuna.ats.jta.recovery.XAResourceOrphanFilter;
-
-
-
-import javax.transaction.xa.Xid;
-import java.util.List;
-
-/**
- * An XAResourceOrphanFilter which uses node name information encoded in the xid to determine if
- * they should be rolled back or not.
- *
- * Note that this filter does not check xid format id, and therefore may attempt to extract node name
- * information from foreign xids, resulting in random behaviour. Probably best combined with a filter
- * that verifies formatIds.
- *
- * @author Jonathan Halliday (jonathan.halliday at redhat.com), 2010-03
- */
-public class SubordinateJTANodeNameXAResourceOrphanFilter implements XAResourceOrphanFilter
-{
-    public static final int RECOVER_ALL_NODES = 0;
-
-    @Override
-    public Vote checkXid(Xid xid)
-    {
-        List<Integer> _xaRecoveryNodes = jtaPropertyManager.getJTAEnvironmentBean().getXaRecoveryNodes();
-
-        if(_xaRecoveryNodes == null || _xaRecoveryNodes.size() == 0) {
-            doWarning();
-            return Vote.ABSTAIN;
-        }
-
-        int nodeName = XAUtils.getSubordinateNodeName(xid);
-
-        if (jtaLogger.logger.isDebugEnabled()) {
-            jtaLogger.logger.debug("node name of " + xid + " is " + nodeName);
-        }
-
-        if (_xaRecoveryNodes.contains(nodeName))
-        {
-            return Vote.ROLLBACK;
-        }
-        else
-        {
-            return Vote.ABSTAIN;
-        }
-    }
-
-    private void doWarning() {
-        jtaLogger.i18NLogger.info_recovery_noxanodes();
-    }
-}

Deleted: labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/recovery/arjunacore/SubordinateJTATransactionLogXAResourceOrphanFilter.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/recovery/arjunacore/SubordinateJTATransactionLogXAResourceOrphanFilter.java	2011-10-17 13:26:50 UTC (rev 37573)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/recovery/arjunacore/SubordinateJTATransactionLogXAResourceOrphanFilter.java	2011-10-17 13:49:58 UTC (rev 37574)
@@ -1,106 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and/or its affiliates,
- * and individual contributors as indicated by the @author tags.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- *
- * (C) 2010,
- * @author JBoss, by Red Hat.
- */
-package com.arjuna.ats.internal.jta.recovery.arjunacore;
-
-import javax.transaction.xa.Xid;
-
-import com.arjuna.ats.arjuna.common.Uid;
-import com.arjuna.ats.arjuna.objectstore.RecoveryStore;
-import com.arjuna.ats.arjuna.objectstore.StateStatus;
-import com.arjuna.ats.arjuna.objectstore.StoreManager;
-import com.arjuna.ats.internal.jta.transaction.arjunacore.subordinate.jca.SubordinateAtomicAction;
-import com.arjuna.ats.jta.logging.jtaLogger;
-import com.arjuna.ats.jta.recovery.XAResourceOrphanFilter;
-import com.arjuna.ats.jta.utils.XAHelper;
-import com.arjuna.ats.jta.xa.XATxConverter;
-import com.arjuna.ats.jta.xa.XidImple;
-
-/**
- * An XAResourceOrphanFilter which vetos rollback for xids owned by top level
- * JTA transactions.
- * 
- * @author Jonathan Halliday (jonathan.halliday at redhat.com), 2010-03
- */
-public class SubordinateJTATransactionLogXAResourceOrphanFilter implements XAResourceOrphanFilter {
-	@Override
-	public Vote checkXid(Xid xid) {
-		if (xid.getFormatId() != XATxConverter.FORMAT_ID) {
-			// we only care about Xids created by the JTA
-			return Vote.ABSTAIN;
-		}
-
-		if (transactionLog(xid)) {
-			// it's owned by a logged transaction which
-			// will recover it top down in due course
-			return Vote.LEAVE_ALONE;
-		}
-
-		return Vote.ABSTAIN;
-	}
-
-	/**
-	 * Is there a log file for this transaction?
-	 * 
-	 * @param xid
-	 *            the transaction to check.
-	 * 
-	 * @return <code>boolean</code>true if there is a log file,
-	 *         <code>false</code> if there isn't.
-	 */
-	private boolean transactionLog(Xid xid) {
-		RecoveryStore recoveryStore = StoreManager.getRecoveryStore();
-		String transactionType = SubordinateAtomicAction.getType();
-
-		XidImple theXid = new XidImple(xid);
-		Uid u = theXid.getTransactionUid();
-
-		if (jtaLogger.logger.isDebugEnabled()) {
-			jtaLogger.logger.debug("Checking whether Xid " + theXid + " exists in ObjectStore.");
-		}
-
-		if (!u.equals(Uid.nullUid())) {
-			try {
-
-				if (jtaLogger.logger.isDebugEnabled()) {
-					jtaLogger.logger.debug("Looking for " + u + " and " + transactionType);
-				}
-
-				if (recoveryStore.currentState(u, transactionType) != StateStatus.OS_UNKNOWN) {
-					if (jtaLogger.logger.isDebugEnabled()) {
-						jtaLogger.logger.debug("Found record for " + theXid);
-					}
-
-					return true;
-				} else {
-					if (jtaLogger.logger.isDebugEnabled()) {
-						jtaLogger.logger.debug("No record found for " + theXid);
-					}
-				}
-			} catch (Exception ex) {
-				ex.printStackTrace();
-			}
-		} else {
-			jtaLogger.i18NLogger.info_recovery_notaxid(XAHelper.xidToString(xid));
-		}
-
-		return false;
-	}
-}

Copied: labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/recovery/arjunacore/SubordinateJTAXAResourceOrphanFilter.java (from rev 37573, labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/recovery/arjunacore/SubordinateJTANodeNameXAResourceOrphanFilter.java)
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/recovery/arjunacore/SubordinateJTAXAResourceOrphanFilter.java	                        (rev 0)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/recovery/arjunacore/SubordinateJTAXAResourceOrphanFilter.java	2011-10-17 13:49:58 UTC (rev 37574)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates,
+ * and individual contributors as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2010,
+ * @author JBoss, by Red Hat.
+ */
+package com.arjuna.ats.internal.jta.recovery.arjunacore;
+
+import java.util.List;
+
+import javax.transaction.xa.Xid;
+
+import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.arjuna.objectstore.RecoveryStore;
+import com.arjuna.ats.arjuna.objectstore.StateStatus;
+import com.arjuna.ats.arjuna.objectstore.StoreManager;
+import com.arjuna.ats.internal.jta.transaction.arjunacore.subordinate.jca.SubordinateAtomicAction;
+import com.arjuna.ats.internal.jta.utils.XAUtils;
+import com.arjuna.ats.jta.common.jtaPropertyManager;
+import com.arjuna.ats.jta.logging.jtaLogger;
+import com.arjuna.ats.jta.recovery.XAResourceOrphanFilter;
+import com.arjuna.ats.jta.utils.XAHelper;
+import com.arjuna.ats.jta.xa.XidImple;
+
+/**
+ * An XAResourceOrphanFilter which uses detects orphaned subordinate XA
+ * Resources.
+ */
+public class SubordinateJTAXAResourceOrphanFilter implements XAResourceOrphanFilter {
+	public static final int RECOVER_ALL_NODES = 0;
+
+	@Override
+	public Vote checkXid(Xid xid) {
+		List<Integer> _xaRecoveryNodes = jtaPropertyManager.getJTAEnvironmentBean().getXaRecoveryNodes();
+
+		if (_xaRecoveryNodes == null || _xaRecoveryNodes.size() == 0) {
+			jtaLogger.i18NLogger.info_recovery_noxanodes();
+			return Vote.ABSTAIN;
+		}
+
+		int nodeName = XAUtils.getSubordinateNodeName(xid);
+
+		if (jtaLogger.logger.isDebugEnabled()) {
+			jtaLogger.logger.debug("subordinate node name of " + xid + " is " + nodeName);
+		}
+
+		if (_xaRecoveryNodes.contains(nodeName)) {
+			if (transactionLog(xid)) {
+				// it's owned by a logged transaction which
+				// will recover it top down in due course
+				return Vote.LEAVE_ALONE;
+			} else {
+				return Vote.ROLLBACK;
+			}
+		} else {
+			return Vote.ABSTAIN;
+		}
+	}
+
+	/**
+	 * Is there a log file for this transaction?
+	 * 
+	 * @param xid
+	 *            the transaction to check.
+	 * 
+	 * @return <code>boolean</code>true if there is a log file,
+	 *         <code>false</code> if there isn't.
+	 */
+	private boolean transactionLog(Xid xid) {
+		RecoveryStore recoveryStore = StoreManager.getRecoveryStore();
+		String transactionType = SubordinateAtomicAction.getType();
+
+		XidImple theXid = new XidImple(xid);
+		Uid u = theXid.getTransactionUid();
+
+		if (jtaLogger.logger.isDebugEnabled()) {
+			jtaLogger.logger.debug("Checking whether Xid " + theXid + " exists in ObjectStore.");
+		}
+
+		if (!u.equals(Uid.nullUid())) {
+			try {
+
+				if (jtaLogger.logger.isDebugEnabled()) {
+					jtaLogger.logger.debug("Looking for " + u + " and " + transactionType);
+				}
+
+				if (recoveryStore.currentState(u, transactionType) != StateStatus.OS_UNKNOWN) {
+					if (jtaLogger.logger.isDebugEnabled()) {
+						jtaLogger.logger.debug("Found record for " + theXid);
+					}
+
+					return true;
+				} else {
+					if (jtaLogger.logger.isDebugEnabled()) {
+						jtaLogger.logger.debug("No record found for " + theXid);
+					}
+				}
+			} catch (Exception ex) {
+				ex.printStackTrace();
+			}
+		} else {
+			jtaLogger.i18NLogger.info_recovery_notaxid(XAHelper.xidToString(xid));
+		}
+
+		return false;
+	}
+}



More information about the jboss-svn-commits mailing list