[jboss-svn-commits] JBL Code SVN: r37620 - in labs/jbosstm/branches/JBOSSTS_4_15_0_Final: atsintegration/examples/classes/com/arjuna/jta/distributed/example/server and 4 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Oct 19 16:18:14 EDT 2011


Author: tomjenkinson
Date: 2011-10-19 16:18:14 -0400 (Wed, 19 Oct 2011)
New Revision: 37620

Modified:
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/jca/XATerminatorImple.java
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/examples/classes/com/arjuna/jta/distributed/example/server/RemoteServer.java
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/examples/classes/com/arjuna/jta/distributed/example/server/impl/ProxyXAResource.java
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/examples/classes/com/arjuna/jta/distributed/example/server/impl/ServerImpl.java
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/SimpleIsolatedServers.java
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/server/RemoteServer.java
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/server/impl/ProxyXAResource.java
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/server/impl/ServerImpl.java
Log:
JBTM-895 updated to povide a recover call that is not related to TMSTARTSCAN and TMENDSCAN as JBossTS doesn't use it so neither does our distributed JTA

Modified: labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/jca/XATerminatorImple.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/jca/XATerminatorImple.java	2011-10-19 19:48:43 UTC (rev 37619)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/jca/XATerminatorImple.java	2011-10-19 20:18:14 UTC (rev 37620)
@@ -322,7 +322,31 @@
         }
 
         // if we are here, then check the object store
+        return recover();
+    }
+    
+    /**
+     * Return a list of indoubt transactions. This may include those
+     * transactions that are currently in-flight and running 2PC and do not need
+     * recovery invoked on them.
+     * 
+     * @param flag
+     *            either XAResource.TMSTARTRSCAN to indicate the start of a
+     *            recovery scan, or XAResource.TMENDRSCAN to indicate the end of
+     *            the recovery scan.
+     * @throws XAException
+     *             thrown if any error occurs.
+     * @return a list of potentially indoubt transactions or <code>null</code>.
+     */
 
+    public synchronized Xid[] recover () throws XAException
+    {
+        /*
+         * Requires going through the objectstore for the states of imported
+         * transactions. Our own crash recovery takes care of transactions
+         * imported via CORBA, Web Services etc.
+         */
+
         Xid[] indoubt = null;
 
         try

Modified: labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/examples/classes/com/arjuna/jta/distributed/example/server/RemoteServer.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/examples/classes/com/arjuna/jta/distributed/example/server/RemoteServer.java	2011-10-19 19:48:43 UTC (rev 37619)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/examples/classes/com/arjuna/jta/distributed/example/server/RemoteServer.java	2011-10-19 20:18:14 UTC (rev 37620)
@@ -33,7 +33,7 @@
 
 	public void propagateRollback(Xid xid) throws XAException, DummyRemoteException;
 
-	public Xid[] propagateRecover(int formatId, byte[] gtrid, int flag) throws XAException, DummyRemoteException;
+	public Xid[] propagateRecover(int formatId, byte[] gtrid) throws XAException, DummyRemoteException;
 
 	public void propagateForget(Xid xid) throws XAException, DummyRemoteException;
 

Modified: labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/examples/classes/com/arjuna/jta/distributed/example/server/impl/ProxyXAResource.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/examples/classes/com/arjuna/jta/distributed/example/server/impl/ProxyXAResource.java	2011-10-19 19:48:43 UTC (rev 37619)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/examples/classes/com/arjuna/jta/distributed/example/server/impl/ProxyXAResource.java	2011-10-19 20:18:14 UTC (rev 37620)
@@ -222,7 +222,7 @@
 
 		if (this.xid != null) {
 			try {
-				recovered = lookupProvider.lookup(remoteServerName).propagateRecover(xid.getFormatId(), xid.getGlobalTransactionId(), flag);
+				recovered = lookupProvider.lookup(remoteServerName).propagateRecover(xid.getFormatId(), xid.getGlobalTransactionId());
 			} catch (DummyRemoteException ce) {
 				throw new XAException(XAException.XA_RETRY);
 			}

Modified: labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/examples/classes/com/arjuna/jta/distributed/example/server/impl/ServerImpl.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/examples/classes/com/arjuna/jta/distributed/example/server/impl/ServerImpl.java	2011-10-19 19:48:43 UTC (rev 37619)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/examples/classes/com/arjuna/jta/distributed/example/server/impl/ServerImpl.java	2011-10-19 20:18:14 UTC (rev 37620)
@@ -246,12 +246,12 @@
 	}
 
 	@Override
-	public Xid[] propagateRecover(int formatId, byte[] gtrid, int flag) throws XAException, DummyRemoteException {
+	public Xid[] propagateRecover(int formatId, byte[] gtrid) throws XAException, DummyRemoteException {
 		ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
 		try {
 			Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
 			List<Xid> toReturn = new ArrayList<Xid>();
-			Xid[] recovered = SubordinationManager.getXATerminator().recover(flag);
+			Xid[] recovered = ((XATerminatorImple) SubordinationManager.getXATerminator()).recover();
 			if (recovered != null) {
 				for (int i = 0; i < recovered.length; i++) {
 					// Filter out the transactions that are not owned by this

Modified: labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/SimpleIsolatedServers.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/SimpleIsolatedServers.java	2011-10-19 19:48:43 UTC (rev 37619)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/SimpleIsolatedServers.java	2011-10-19 20:18:14 UTC (rev 37620)
@@ -50,6 +50,7 @@
 
 import com.arjuna.ats.arjuna.common.CoreEnvironmentBeanException;
 import com.arjuna.ats.jta.distributed.server.CompletionCounter;
+import com.arjuna.ats.jta.distributed.server.DummyRemoteException;
 import com.arjuna.ats.jta.distributed.server.IsolatableServersClassLoader;
 import com.arjuna.ats.jta.distributed.server.LocalServer;
 import com.arjuna.ats.jta.distributed.server.LookupProvider;
@@ -85,7 +86,29 @@
 		}
 	}
 
+	/**
+	 * The JCA XATerminator call wont allow intermediary calls to
+	 * XATerminator::recover between TMSTARTSCAN and TMENDSCAN. This is fine for
+	 * distributed JTA.
+	 * 
+	 * @throws XAException
+	 * @throws DummyRemoteException
+	 */
 	@Test
+	public void testSimultaneousRecover() throws XAException, DummyRemoteException {
+		// Simulates different servers attempting to recover the XIDs from the
+		// same server
+		{
+			RemoteServer server = lookupProvider.lookup(2000);
+			server.propagateRecover(0, null);
+		}
+		{
+			RemoteServer server = lookupProvider.lookup(2000);
+			server.propagateRecover(0, null);
+		}
+	}
+
+	@Test
 	@BMScript("leaveorphan")
 	public void testCreateOrphan() throws Exception {
 		assertTrue(getLocalServer(3000).getCompletionCounter().getCommitCount() == 0);
@@ -218,9 +241,6 @@
 		}
 		tearDown();
 		setup();
-		// Start out at the first server
-		// getLocalServer(3000).doRecoveryManagerScan();
-		// getLocalServer(2000).doRecoveryManagerScan();
 		getLocalServer(1000).doRecoveryManagerScan(false);
 
 		assertTrue(getLocalServer(1000).getCompletionCounter().getCommitCount() == 4);

Modified: labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/server/RemoteServer.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/server/RemoteServer.java	2011-10-19 19:48:43 UTC (rev 37619)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/server/RemoteServer.java	2011-10-19 20:18:14 UTC (rev 37620)
@@ -35,7 +35,7 @@
 
 	public void propagateRollback(Xid xid) throws XAException, DummyRemoteException;
 
-	public Xid[] propagateRecover(int formatId, byte[] gtrid, int flag) throws XAException, DummyRemoteException;
+	public Xid[] propagateRecover(int formatId, byte[] gtrid) throws XAException, DummyRemoteException;
 
 	public void propagateForget(Xid xid) throws XAException, DummyRemoteException;
 

Modified: labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/server/impl/ProxyXAResource.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/server/impl/ProxyXAResource.java	2011-10-19 19:48:43 UTC (rev 37619)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/server/impl/ProxyXAResource.java	2011-10-19 20:18:14 UTC (rev 37620)
@@ -233,7 +233,7 @@
 
 		if (this.xid != null) {
 			try {
-				recovered = lookupProvider.lookup(remoteServerName).propagateRecover(xid.getFormatId(), xid.getGlobalTransactionId(), flag);
+				recovered = lookupProvider.lookup(remoteServerName).propagateRecover(xid.getFormatId(), xid.getGlobalTransactionId());
 			} catch (DummyRemoteException ce) {
 				throw new XAException(XAException.XA_RETRY);
 			}

Modified: labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/server/impl/ServerImpl.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/server/impl/ServerImpl.java	2011-10-19 19:48:43 UTC (rev 37619)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/server/impl/ServerImpl.java	2011-10-19 20:18:14 UTC (rev 37620)
@@ -349,12 +349,12 @@
 	}
 
 	@Override
-	public Xid[] propagateRecover(int formatId, byte[] gtrid, int flag) throws XAException, DummyRemoteException {
+	public Xid[] propagateRecover(int formatId, byte[] gtrid) throws XAException, DummyRemoteException {
 		ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
 		try {
 			Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
 			List<Xid> toReturn = new ArrayList<Xid>();
-			Xid[] recovered = SubordinationManager.getXATerminator().recover(flag);
+			Xid[] recovered = ((XATerminatorImple) SubordinationManager.getXATerminator()).recover();
 			if (recovered != null) {
 				for (int i = 0; i < recovered.length; i++) {
 					// Filter out the transactions that are not owned by this



More information about the jboss-svn-commits mailing list