[jboss-svn-commits] JBL Code SVN: r37654 - in labs/jbosstm/branches/JBOSSTS_4_15_0_Final: ArjunaJTA/jta/classes/com/arjuna/ats/jta/common and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Oct 21 09:26:15 EDT 2011


Author: tomjenkinson
Date: 2011-10-21 09:26:14 -0400 (Fri, 21 Oct 2011)
New Revision: 37654

Modified:
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/CoreEnvironmentBean.java
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaJTA/jta/classes/com/arjuna/ats/jta/common/JTAEnvironmentBean.java
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaJTA/jta/tests/classes/com/hp/mwtests/ts/jta/recovery/XAResourceOrphanFilterTest.java
Log:
JBTM-895 reset to provide a String interface to set the node name but if the string is not convertable to an integer then you will get a runtime exception

Modified: labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/CoreEnvironmentBean.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/CoreEnvironmentBean.java	2011-10-21 12:31:13 UTC (rev 37653)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/common/CoreEnvironmentBean.java	2011-10-21 13:26:14 UTC (rev 37654)
@@ -117,6 +117,28 @@
     }
 
     /**
+     * Sets the node identifier. Should be uniq amongst all instances that share resource managers or an objectstore. It should be set as the String value of an integer.
+     *
+     * @param nodeIdentifier the Node Identifier.
+     * @throws CoreEnvironmentBeanException 
+     * @deprecated
+     */
+    public void setNodeIdentifier(String nodeIdentifierAsString)
+    {
+    	Integer nodeIdentifier = null;
+    	
+    	try {
+    		nodeIdentifier = Integer.valueOf(nodeIdentifierAsString);
+        	setNodeIdentifier(nodeIdentifier);
+    	} catch (NumberFormatException nfe) {
+    		throw new RuntimeException(tsLogger.i18NLogger.get_node_identifier_invalid(nodeIdentifier));
+    	} catch (CoreEnvironmentBeanException e) {
+			throw new RuntimeException(e);
+		}
+    	
+    }
+
+    /**
      * Returns the port number for the Socket based process id implementation.
      *
      * Default: 0 (use any free port)

Modified: labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaJTA/jta/classes/com/arjuna/ats/jta/common/JTAEnvironmentBean.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaJTA/jta/classes/com/arjuna/ats/jta/common/JTAEnvironmentBean.java	2011-10-21 12:31:13 UTC (rev 37653)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaJTA/jta/classes/com/arjuna/ats/jta/common/JTAEnvironmentBean.java	2011-10-21 13:26:14 UTC (rev 37654)
@@ -21,12 +21,14 @@
 package com.arjuna.ats.jta.common;
 
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 
 import javax.transaction.TransactionManager;
 import javax.transaction.TransactionSynchronizationRegistry;
 import javax.transaction.UserTransaction;
 
+import com.arjuna.ats.arjuna.logging.tsLogger;
 import com.arjuna.ats.internal.arjuna.common.ClassloadingUtility;
 import com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecordWrappingPlugin;
 import com.arjuna.ats.jta.recovery.XAResourceOrphanFilter;
@@ -374,8 +376,35 @@
      * The provided list will be copied, not retained.
      *
      * @param xaRecoveryNodes the set of node identifiers for which to perform recovery.
+     * @deprecated
      */
-    public void setXaRecoveryNodes(List<Integer> xaRecoveryNodes)
+	public void setXaRecoveryNodes(List<String> xaRecoveryNodes) {
+
+		ArrayList<Integer> arrayList = new ArrayList<Integer>();
+		Iterator<String> iterator = xaRecoveryNodes.iterator();
+		while (iterator.hasNext()) {
+			Integer nodeIdentifier = null;
+			try {
+				nodeIdentifier = Integer.valueOf(iterator.next());
+			} catch (NumberFormatException nfe) {
+				throw new RuntimeException(tsLogger.i18NLogger.get_node_identifier_invalid(nodeIdentifier));
+			}
+			if (nodeIdentifier < 1) {
+				throw new RuntimeException(tsLogger.i18NLogger.get_node_identifier_invalid(nodeIdentifier));
+			}
+			arrayList.add(Integer.valueOf(nodeIdentifier));
+		}
+		setXaRecoveryNodesImpl(arrayList);
+	}
+    
+
+    /**
+     * Sets the node identifiers for which recovery will be performed.
+     * The provided list will be copied, not retained.
+     *
+     * @param xaRecoveryNodes the set of node identifiers for which to perform recovery.
+     */
+    public void setXaRecoveryNodesImpl(List<Integer> xaRecoveryNodes)
     {
         if(xaRecoveryNodes == null) {
             this.xaRecoveryNodes = new ArrayList<Integer>(); 

Modified: labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaJTA/jta/tests/classes/com/hp/mwtests/ts/jta/recovery/XAResourceOrphanFilterTest.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaJTA/jta/tests/classes/com/hp/mwtests/ts/jta/recovery/XAResourceOrphanFilterTest.java	2011-10-21 12:31:13 UTC (rev 37653)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaJTA/jta/tests/classes/com/hp/mwtests/ts/jta/recovery/XAResourceOrphanFilterTest.java	2011-10-21 13:26:14 UTC (rev 37654)
@@ -55,7 +55,7 @@
 
         List<Integer> recoveryNodes = new LinkedList<Integer>();
         recoveryNodes.add(1);
-        jtaPropertyManager.getJTAEnvironmentBean().setXaRecoveryNodes(recoveryNodes);
+        jtaPropertyManager.getJTAEnvironmentBean().setXaRecoveryNodesImpl(recoveryNodes);
 
         int notRecoverableNodeName =2;
         TxControl.setXANodeName(notRecoverableNodeName);
@@ -71,7 +71,7 @@
 
         recoveryNodes.clear();
         recoveryNodes.add(NodeNameXAResourceOrphanFilter.RECOVER_ALL_NODES);
-        jtaPropertyManager.getJTAEnvironmentBean().setXaRecoveryNodes(recoveryNodes);
+        jtaPropertyManager.getJTAEnvironmentBean().setXaRecoveryNodesImpl(recoveryNodes);
 
         assertEquals(XAResourceOrphanFilter.Vote.ROLLBACK, orphanFilter.checkXid(jtaNotRecoverableNodeName));
         assertEquals(XAResourceOrphanFilter.Vote.ROLLBACK, orphanFilter.checkXid(jtaRecoverableNodeName));



More information about the jboss-svn-commits mailing list