[jboss-svn-commits] JBL Code SVN: r37624 - in labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed: server/impl and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Oct 20 04:05:38 EDT 2011


Author: tomjenkinson
Date: 2011-10-20 04:05:37 -0400 (Thu, 20 Oct 2011)
New Revision: 37624

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/server/impl/ProxyXAResource.java
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/server/impl/ProxyXAResourceRecovery.java
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/server/impl/ServerImpl.java
Log:
JBTM-917 JBTM-895 updated to ensure that recovery will work for scenarios where we have not prepared the transaction

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-20 01:43:32 UTC (rev 37623)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/SimpleIsolatedServers.java	2011-10-20 08:05:37 UTC (rev 37624)
@@ -23,6 +23,9 @@
 
 import static org.junit.Assert.assertTrue;
 
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.LinkedList;
@@ -49,6 +52,7 @@
 import org.junit.runner.RunWith;
 
 import com.arjuna.ats.arjuna.common.CoreEnvironmentBeanException;
+import com.arjuna.ats.arjuna.common.Uid;
 import com.arjuna.ats.jta.distributed.server.CompletionCounter;
 import com.arjuna.ats.jta.distributed.server.DummyRemoteException;
 import com.arjuna.ats.jta.distributed.server.IsolatableServersClassLoader;
@@ -110,7 +114,7 @@
 
 	@Test
 	@BMScript("leaveorphan")
-	public void testCreateOrphan() throws Exception {
+	public void testTwoPhaseXAResourceOrphan() throws Exception {
 		assertTrue(getLocalServer(3000).getCompletionCounter().getCommitCount() == 0);
 		assertTrue(getLocalServer(2000).getCompletionCounter().getCommitCount() == 0);
 		assertTrue(getLocalServer(1000).getCompletionCounter().getCommitCount() == 0);
@@ -131,6 +135,7 @@
 					Xid currentXid = originalServer.getCurrentXid();
 					originalServer.storeRootTransaction();
 					transactionManager.suspend();
+					persistProxy(originalServer.getNodeName(), 2000, currentXid);
 					performTransactionalWork(null, new LinkedList<Integer>(Arrays.asList(new Integer[] { 2000 })), remainingTimeout, currentXid, 1, false);
 					transactionManager.resume(originalTransaction);
 					XAResource proxyXAResource = originalServer.generateProxyXAResource(lookupProvider, originalServer.getNodeName(), 2000);
@@ -181,13 +186,13 @@
 			assertTrue(server.getCompletionCounter().getRollbackCount() == 0);
 			server.doRecoveryManagerScan(true);
 			assertTrue(server.getCompletionCounter().getCommitCount() == 0);
-			assertTrue(server.getCompletionCounter().getRollbackCount() == 1);
+			assertTrue(server.getCompletionCounter().getRollbackCount() == 0);
 		}
 	}
 
 	@Test
 	@BMScript("leaveorphan")
-	public void testOnePhaseOrphan() throws Exception {
+	public void testOnePhaseXAResourceOrphan() throws Exception {
 		assertTrue(getLocalServer(3000).getCompletionCounter().getCommitCount() == 0);
 		assertTrue(getLocalServer(2000).getCompletionCounter().getCommitCount() == 0);
 		assertTrue(getLocalServer(1000).getCompletionCounter().getCommitCount() == 0);
@@ -208,6 +213,7 @@
 					Xid currentXid = originalServer.getCurrentXid();
 					originalServer.storeRootTransaction();
 					transactionManager.suspend();
+					persistProxy(originalServer.getNodeName(), 2000, currentXid);
 					performTransactionalWork(null, new LinkedList<Integer>(Arrays.asList(new Integer[] { 2000 })), remainingTimeout, currentXid, 2, false);
 					transactionManager.resume(originalTransaction);
 					XAResource proxyXAResource = originalServer.generateProxyXAResource(lookupProvider, originalServer.getNodeName(), 2000);
@@ -259,7 +265,7 @@
 			assertTrue(server.getCompletionCounter().getRollbackCount() == 0);
 			server.doRecoveryManagerScan(true);
 			assertTrue(server.getCompletionCounter().getCommitCount() == 0);
-			assertTrue(server.getCompletionCounter().getRollbackCount() == 1);
+			assertTrue(server.getCompletionCounter().getRollbackCount() == 0);
 		}
 	}
 
@@ -286,6 +292,7 @@
 					Xid currentXid = originalServer.getCurrentXid();
 					originalServer.storeRootTransaction();
 					transactionManager.suspend();
+					persistProxy(originalServer.getNodeName(), 2000, currentXid);
 					performTransactionalWork(null, new LinkedList<Integer>(Arrays.asList(new Integer[] { 2000 })), remainingTimeout, currentXid, 2, false);
 					transactionManager.resume(originalTransaction);
 					XAResource proxyXAResource = originalServer.generateProxyXAResource(lookupProvider, originalServer.getNodeName(), 2000);
@@ -385,6 +392,9 @@
 						phase2CommitAborted.setPhase2CommitAborted(true);
 						phase2CommitAborted.notify();
 					}
+				} catch (IOException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
 				}
 			}
 		});
@@ -407,8 +417,8 @@
 	}
 
 	@Test
-	public void testOnePhaseCommit() throws NotSupportedException, SystemException, IllegalStateException, RollbackException, InvalidTransactionException,
-			XAException, SecurityException, HeuristicMixedException, HeuristicRollbackException {
+	public void testOnePhaseCommit() throws NotSupportedException, SystemException, IllegalStateException, RollbackException, XAException, SecurityException,
+			HeuristicMixedException, HeuristicRollbackException, IOException {
 		int startingServer = 1000;
 		LocalServer originalServer = getLocalServer(startingServer);
 		ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
@@ -421,6 +431,7 @@
 		Xid currentXid = originalServer.getCurrentXid();
 		originalServer.storeRootTransaction();
 		transactionManager.suspend();
+		persistProxy(originalServer.getNodeName(), 2000, currentXid);
 		performTransactionalWork(null, new LinkedList<Integer>(Arrays.asList(new Integer[] { 2000 })), remainingTimeout, currentXid, 1, false);
 		transactionManager.resume(originalTransaction);
 		XAResource proxyXAResource = originalServer.generateProxyXAResource(lookupProvider, originalServer.getNodeName(), 2000);
@@ -431,8 +442,8 @@
 	}
 
 	@Test
-	public void testUnPreparedRollback() throws NotSupportedException, SystemException, IllegalStateException, RollbackException, InvalidTransactionException,
-			XAException, SecurityException, HeuristicMixedException, HeuristicRollbackException {
+	public void testUnPreparedRollback() throws NotSupportedException, SystemException, IllegalStateException, RollbackException, XAException,
+			SecurityException, HeuristicMixedException, HeuristicRollbackException, IOException {
 		int startingServer = 1000;
 		LocalServer originalServer = getLocalServer(startingServer);
 		ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
@@ -445,6 +456,7 @@
 		Xid currentXid = originalServer.getCurrentXid();
 		originalServer.storeRootTransaction();
 		transactionManager.suspend();
+		persistProxy(originalServer.getNodeName(), 2000, currentXid);
 		performTransactionalWork(null, new LinkedList<Integer>(Arrays.asList(new Integer[] { 2000 })), remainingTimeout, currentXid, 1, false);
 		transactionManager.resume(originalTransaction);
 		XAResource proxyXAResource = originalServer.generateProxyXAResource(lookupProvider, originalServer.getNodeName(), 2000);
@@ -457,16 +469,16 @@
 	}
 
 	@Test
-	public void testMigrateTransactionCommit() throws NotSupportedException, SystemException, IllegalStateException, RollbackException,
-			InvalidTransactionException, XAException, SecurityException, HeuristicMixedException, HeuristicRollbackException {
+	public void testMigrateTransactionCommit() throws NotSupportedException, SystemException, IllegalStateException, RollbackException, XAException,
+			SecurityException, HeuristicMixedException, HeuristicRollbackException, IOException {
 		int startingTimeout = 0;
 		List<Integer> nodesToFlowTo = new LinkedList<Integer>(Arrays.asList(new Integer[] { 1000, 2000, 3000, 2000, 1000, 2000, 3000, 1000, 3000 }));
 		doRecursiveTransactionalWork(startingTimeout, nodesToFlowTo, true);
 	}
 
 	@Test
-	public void testMigrateTransactionCommitDiamond() throws NotSupportedException, SystemException, IllegalStateException, RollbackException,
-			InvalidTransactionException, XAException, SecurityException, HeuristicMixedException, HeuristicRollbackException {
+	public void testMigrateTransactionCommitDiamond() throws NotSupportedException, SystemException, IllegalStateException, RollbackException, XAException,
+			SecurityException, HeuristicMixedException, HeuristicRollbackException, IOException {
 
 		int startingTimeout = 0;
 		List<Integer> nodesToFlowTo = new LinkedList<Integer>(Arrays.asList(new Integer[] { 1000, 2000, 1000, 3000, 1000, 2000, 3000 }));
@@ -474,16 +486,16 @@
 	}
 
 	@Test
-	public void testMigrateTransactionRollback() throws NotSupportedException, SystemException, IllegalStateException, RollbackException,
-			InvalidTransactionException, XAException, SecurityException, HeuristicMixedException, HeuristicRollbackException {
+	public void testMigrateTransactionRollback() throws NotSupportedException, SystemException, IllegalStateException, RollbackException, XAException,
+			SecurityException, HeuristicMixedException, HeuristicRollbackException, IOException {
 		int startingTimeout = 0;
 		List<Integer> nodesToFlowTo = new LinkedList<Integer>(Arrays.asList(new Integer[] { 1000, 2000, 3000, 2000, 1000, 2000, 3000, 1000, 3000 }));
 		doRecursiveTransactionalWork(startingTimeout, nodesToFlowTo, false);
 	}
 
 	@Test
-	public void testMigrateTransactionRollbackDiamond() throws NotSupportedException, SystemException, IllegalStateException, RollbackException,
-			InvalidTransactionException, XAException, SecurityException, HeuristicMixedException, HeuristicRollbackException {
+	public void testMigrateTransactionRollbackDiamond() throws NotSupportedException, SystemException, IllegalStateException, RollbackException, XAException,
+			SecurityException, HeuristicMixedException, HeuristicRollbackException, IOException {
 		int startingTimeout = 0;
 		List<Integer> nodesToFlowTo = new LinkedList<Integer>(Arrays.asList(new Integer[] { 1000, 2000, 1000, 3000, 1000, 2000, 3000 }));
 		doRecursiveTransactionalWork(startingTimeout, nodesToFlowTo, false);
@@ -491,7 +503,7 @@
 
 	@Test
 	public void testMigrateTransactionSubordinateTimeout() throws NotSupportedException, SystemException, IllegalStateException, RollbackException,
-			InvalidTransactionException, XAException, SecurityException, HeuristicMixedException, HeuristicRollbackException, InterruptedException {
+			XAException, SecurityException, HeuristicMixedException, HeuristicRollbackException, InterruptedException, IOException {
 		int rootTimeout = 10000;
 		int subordinateTimeout = 1;
 
@@ -534,16 +546,17 @@
 		transactionManager.setTransactionTimeout(rootTimeout);
 		transactionManager.begin();
 		Transaction originalTransaction = transactionManager.getTransaction();
-		Xid toMigrate = originalServer.getCurrentXid();
+		Xid currentXid = originalServer.getCurrentXid();
 		originalServer.storeRootTransaction();
 		originalTransaction.enlistResource(new TestResource(counter, originalServer.getNodeName(), false));
 		transactionManager.suspend();
+		persistProxy(originalServer.getNodeName(), 2000, currentXid);
 
 		// Migrate a transaction
 		LocalServer currentServer = getLocalServer(2000);
 		ClassLoader parentsClassLoader = Thread.currentThread().getContextClassLoader();
 		Thread.currentThread().setContextClassLoader(currentServer.getClass().getClassLoader());
-		currentServer.getAndResumeTransaction(subordinateTimeout, toMigrate);
+		currentServer.getAndResumeTransaction(subordinateTimeout, currentXid);
 		currentServer.getTransactionManager().getTransaction().enlistResource(new TestResource(counter, currentServer.getNodeName(), false));
 		currentServer.getTransactionManager().suspend();
 		Thread.currentThread().setContextClassLoader(parentsClassLoader);
@@ -552,7 +565,7 @@
 		transactionManager.resume(originalTransaction);
 		XAResource proxyXAResource = originalServer.generateProxyXAResource(lookupProvider, originalServer.getNodeName(), 2000);
 		originalTransaction.enlistResource(proxyXAResource);
-		originalServer.removeRootTransaction(toMigrate);
+		originalServer.removeRootTransaction(currentXid);
 		Thread.currentThread().sleep((subordinateTimeout + 1) * 1000);
 		try {
 			transactionManager.commit();
@@ -565,8 +578,7 @@
 	}
 
 	private void doRecursiveTransactionalWork(int startingTimeout, List<Integer> nodesToFlowTo, boolean commit) throws NotSupportedException, SystemException,
-			RollbackException, InvalidTransactionException, IllegalStateException, XAException, SecurityException, HeuristicMixedException,
-			HeuristicRollbackException {
+			RollbackException, IllegalStateException, XAException, SecurityException, HeuristicMixedException, HeuristicRollbackException, IOException {
 
 		// Start out at the first server
 		CompletionCounter counter = new CompletionCounter() {
@@ -627,8 +639,8 @@
 	}
 
 	private boolean performTransactionalWork(CompletionCounter counter, List<Integer> nodesToFlowTo, int remainingTimeout, Xid toMigrate,
-			int numberOfResourcesToRegister, boolean addSynchronization) throws RollbackException, InvalidTransactionException, IllegalStateException,
-			XAException, SystemException, NotSupportedException {
+			int numberOfResourcesToRegister, boolean addSynchronization) throws RollbackException, IllegalStateException, XAException, SystemException,
+			NotSupportedException, IOException {
 		Integer currentServerName = nodesToFlowTo.remove(0);
 		LocalServer currentServer = getLocalServer(currentServerName);
 
@@ -655,6 +667,9 @@
 			// SUSPEND THE TRANSACTION
 			Xid currentXid = currentServer.getCurrentXid();
 			transactionManager.suspend();
+
+			persistProxy(currentServer.getNodeName(), nodesToFlowTo.get(0), currentXid);
+
 			boolean proxyRequired = performTransactionalWork(counter, nodesToFlowTo, remainingTimeout, currentXid, numberOfResourcesToRegister,
 					addSynchronization);
 			transactionManager.resume(transaction);
@@ -685,6 +700,26 @@
 		return localServers[index];
 	}
 
+	private synchronized void persistProxy(Integer localServerName, Integer remoteServerName, Xid xid) throws IOException {
+		// Persist a proxy for the remote server this can mean we try to recover
+		// transactions at a remote server that did not get chance to
+		// prepare but the alternative is to orphan a prepared server
+
+		File dir = new File(System.getProperty("user.dir") + "/distributedjta/ProxyXAResource/" + localServerName);
+		dir.mkdirs();
+		File file = new File(dir, new Uid().fileStringForm());
+		if (!file.exists()) {
+			file.createNewFile();
+			DataOutputStream fos = new DataOutputStream(new FileOutputStream(file));
+			fos.writeInt(remoteServerName);
+			fos.writeInt(xid.getFormatId());
+			fos.writeInt(xid.getGlobalTransactionId().length);
+			fos.write(xid.getGlobalTransactionId());
+			fos.writeInt(xid.getBranchQualifier().length);
+			fos.write(xid.getBranchQualifier());
+		}
+	}
+
 	private static class MyLookupProvider implements LookupProvider {
 
 		@Override

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-20 01:43:32 UTC (rev 37623)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/server/impl/ProxyXAResource.java	2011-10-20 08:05:37 UTC (rev 37624)
@@ -115,9 +115,35 @@
 	public synchronized int prepare(Xid xid) throws XAException {
 		System.out.println("     ProxyXAResource (" + localServerName + ":" + remoteServerName + ") XA_PREPARE [" + xid + "]");
 
-		persistProxy(xid);
+		// Persist a proxy for the remote server this can mean we try to recover
+		// a transaction at a remote server that did not get chance to
+		// prepare but the alternative is to orphan a prepared server
 
 		try {
+			File dir = new File(System.getProperty("user.dir") + "/distributedjta/ProxyXAResource/" + localServerName + "/");
+			dir.mkdirs();
+			File file = new File(dir, new Uid().fileStringForm());
+			file.createNewFile();
+			DataOutputStream fos = new DataOutputStream(new FileOutputStream(file));
+			fos.writeInt(remoteServerName);
+			fos.writeInt(xid.getFormatId());
+			fos.writeInt(xid.getGlobalTransactionId().length);
+			fos.write(xid.getGlobalTransactionId());
+			fos.writeInt(xid.getBranchQualifier().length);
+			fos.write(xid.getBranchQualifier());
+
+			if (map.containsKey(xid)) {
+				System.out.println(map.get(xid));
+				map.remove(xid).delete();
+			}
+
+			map.put(xid, file);
+		} catch (IOException e) {
+			e.printStackTrace();
+			throw new XAException(XAException.XAER_RMERR);
+		}
+
+		try {
 			int propagatePrepare = lookupProvider.lookup(remoteServerName).propagatePrepare(xid);
 			System.out.println("     ProxyXAResource (" + localServerName + ":" + remoteServerName + ") XA_PREPARED");
 			return propagatePrepare;
@@ -130,8 +156,6 @@
 	public synchronized void commit(Xid xid, boolean onePhase) throws XAException {
 		System.out.println("     ProxyXAResource (" + localServerName + ":" + remoteServerName + ") XA_COMMIT  [" + xid + "]");
 
-		persistProxy(xid);
-
 		try {
 			lookupProvider.lookup(remoteServerName).propagateCommit(xid, onePhase);
 			System.out.println("     ProxyXAResource (" + localServerName + ":" + remoteServerName + ") XA_COMMITED");
@@ -152,8 +176,6 @@
 	public synchronized void rollback(Xid xid) throws XAException {
 		System.out.println("     ProxyXAResource (" + localServerName + ":" + remoteServerName + ") XA_ROLLBACK[" + xid + "]");
 
-		persistProxy(xid);
-
 		try {
 			lookupProvider.lookup(remoteServerName).propagateRollback(xid);
 			System.out.println("     ProxyXAResource (" + localServerName + ":" + remoteServerName + ") XA_ROLLBACKED");
@@ -208,25 +230,30 @@
 
 		List<Xid> arrayList = new ArrayList<Xid>();
 		arrayList.addAll(map.keySet());
-		for (int i = 0; i < recovered.length; i++) {
-			System.out.println("     ProxyXAResource (" + localServerName + ":" + remoteServerName + ") recovered: " + recovered[i]);
-			Iterator<Xid> iterator = map.keySet().iterator();
-			while (iterator.hasNext()) {
-				Xid next = iterator.next();
-				if (Arrays.equals(next.getGlobalTransactionId(), recovered[i].getGlobalTransactionId())) {
-					toReturn.add(next);
-				} else if (!iterator.hasNext()) {
-					toReturn.add(recovered[i]);
+		if (recovered != null) {
+			for (int i = 0; i < recovered.length; i++) {
+				System.out.println("     ProxyXAResource (" + localServerName + ":" + remoteServerName + ") recovered: " + recovered[i]);
+				Iterator<Xid> iterator = map.keySet().iterator();
+				while (iterator.hasNext()) {
+					Xid next = iterator.next();
+					if (Arrays.equals(next.getGlobalTransactionId(), recovered[i].getGlobalTransactionId())) {
+						toReturn.add(next);
+					} else if (!iterator.hasNext()) {
+						toReturn.add(recovered[i]);
+					}
+					arrayList.remove(next);
 				}
-				arrayList.remove(next);
+				System.out.println("     ProxyXAResource (" + localServerName + ":" + remoteServerName + ") added: " + toReturn.get(toReturn.size() - 1));
 			}
-			System.out.println("     ProxyXAResource (" + localServerName + ":" + remoteServerName + ") added: " + toReturn.get(toReturn.size() - 1));
 		}
 
-		Iterator<Xid> iterator = arrayList.iterator();
+		// We now know the remote server didn't know about these Xids
+		List<Xid> knownNoneKnownXids = new ArrayList<Xid>();
+		knownNoneKnownXids.addAll(arrayList);
+		Iterator<Xid> iterator = knownNoneKnownXids.iterator();
 		while (iterator.hasNext()) {
 			Xid next = iterator.next();
-			toReturn.add(next);
+			map.remove(next).delete();
 		}
 		if ((flag & XAResource.TMSTARTRSCAN) == XAResource.TMSTARTRSCAN) {
 			System.out.println("     ProxyXAResource (" + localServerName + ":" + remoteServerName + ") XA_RECOVERD[XAResource.TMSTARTRSCAN]: "
@@ -304,30 +331,4 @@
 	public String getJndiName() {
 		return "ProxyXAResource: " + localServerName + " " + remoteServerName;
 	}
-
-	private void persistProxy(Xid xid) throws XAException {
-		// Persist a proxy for the remote server this can mean we try to recover
-		// a transaction at a remote server that did not get chance to
-		// prepare but the alternative is to orphan a prepared server
-
-		if (!map.containsKey(xid)) {
-			try {
-				File dir = new File(System.getProperty("user.dir") + "/distributedjta/ProxyXAResource/" + localServerName + "/");
-				dir.mkdirs();
-				File file = new File(dir, new Uid().fileStringForm());
-				file.createNewFile();
-				DataOutputStream fos = new DataOutputStream(new FileOutputStream(file));
-				fos.writeInt(remoteServerName);
-				fos.writeInt(xid.getFormatId());
-				fos.writeInt(xid.getGlobalTransactionId().length);
-				fos.write(xid.getGlobalTransactionId());
-				fos.writeInt(xid.getBranchQualifier().length);
-				fos.write(xid.getBranchQualifier());
-				map.put(xid, file);
-			} catch (IOException e) {
-				e.printStackTrace();
-				throw new XAException(XAException.XAER_RMERR);
-			}
-		}
-	}
 }

Modified: labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/server/impl/ProxyXAResourceRecovery.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/server/impl/ProxyXAResourceRecovery.java	2011-10-20 01:43:32 UTC (rev 37623)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/server/impl/ProxyXAResourceRecovery.java	2011-10-20 08:05:37 UTC (rev 37624)
@@ -63,6 +63,7 @@
 				int gtrid_length = fis.readInt();
 				final byte[] gtrid = new byte[gtrid_length];
 				fis.read(gtrid, 0, gtrid_length);
+
 				int bqual_length = fis.readInt();
 				final byte[] bqual = new byte[bqual_length];
 				fis.read(bqual, 0, bqual_length);

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-20 01:43:32 UTC (rev 37623)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/server/impl/ServerImpl.java	2011-10-20 08:05:37 UTC (rev 37624)
@@ -66,8 +66,6 @@
 import com.arjuna.ats.jta.distributed.server.LocalServer;
 import com.arjuna.ats.jta.distributed.server.LookupProvider;
 import com.arjuna.ats.jta.distributed.server.RemoteServer;
-import com.arjuna.ats.jta.xa.XATxConverter;
-import com.arjuna.ats.jta.xa.XidImple;
 
 public class ServerImpl implements LocalServer, RemoteServer {
 
@@ -353,19 +351,8 @@
 		ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
 		try {
 			Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
-			List<Xid> toReturn = new ArrayList<Xid>();
-			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
-					// parent
-					if ((recovered[i].getFormatId() == XATxConverter.FORMAT_ID && parentNodeName == XATxConverter.getParentNodeName(((XidImple) recovered[i])
-							.getXID()))) {
-						toReturn.add(recovered[i]);
-					}
-				}
-			}
-			return toReturn.toArray(new Xid[0]);
+			Xid[] recovered = ((XATerminatorImple) SubordinationManager.getXATerminator()).doRecover(parentNodeName);
+			return recovered;
 		} finally {
 			Thread.currentThread().setContextClassLoader(contextClassLoader);
 		}



More information about the jboss-svn-commits mailing list