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

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Oct 18 03:46:56 EDT 2011


Author: tomjenkinson
Date: 2011-10-18 03:46:56 -0400 (Tue, 18 Oct 2011)
New Revision: 37584

Added:
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/server/CompletionCounter.java
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/TestResource.java
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/TestResourceRecovery.java
   labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/server/LocalServer.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 test to count completion calls

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-17 22:21:29 UTC (rev 37583)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/SimpleIsolatedServers.java	2011-10-18 07:46:56 UTC (rev 37584)
@@ -1,5 +1,7 @@
 package com.arjuna.ats.jta.distributed;
 
+import static org.junit.Assert.assertTrue;
+
 import java.io.File;
 import java.io.IOException;
 import java.util.Arrays;
@@ -22,6 +24,7 @@
 import org.junit.Test;
 
 import com.arjuna.ats.arjuna.common.CoreEnvironmentBeanException;
+import com.arjuna.ats.jta.distributed.server.CompletionCounter;
 import com.arjuna.ats.jta.distributed.server.IsolatableServersClassLoader;
 import com.arjuna.ats.jta.distributed.server.LocalServer;
 import com.arjuna.ats.jta.distributed.server.LookupProvider;
@@ -47,10 +50,18 @@
 	}
 
 	@Test
-	public void testRecovery() {
+	public void testRecovery() throws IOException {
+		assertTrue(getLocalServer(3000).getCompletionCounter().getCommitCount() == 0);
+		assertTrue(getLocalServer(2000).getCompletionCounter().getCommitCount() == 0);
+		assertTrue(getLocalServer(1000).getCompletionCounter().getCommitCount() == 0);
+		// Start out at the first server
 		// getLocalServer(3000).doRecoveryManagerScan();
 		// getLocalServer(2000).doRecoveryManagerScan();
 		getLocalServer(1000).doRecoveryManagerScan();
+
+		assertTrue(getLocalServer(1000).getCompletionCounter().getCommitCount() == 3);
+		assertTrue(getLocalServer(2000).getCompletionCounter().getCommitCount() == 3);
+		assertTrue(getLocalServer(3000).getCompletionCounter().getCommitCount() == 3);
 	}
 
 	@Test
@@ -63,27 +74,49 @@
 		}
 		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);
+	}
 
-		// Start out at the first server
-		LocalServer originalServer = getLocalServer(1000);
-		ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
-		Thread.currentThread().setContextClassLoader(originalServer.getClass().getClassLoader());
-		TransactionManager transactionManager = originalServer.getTransactionManager();
-		transactionManager.setTransactionTimeout(startingTimeout);
-		transactionManager.begin();
-		Transaction originalTransaction = transactionManager.getTransaction();
-		int remainingTimeout = (int) (originalServer.getTimeLeftBeforeTransactionTimeout() / 1000);
-		Xid currentXid = originalServer.getCurrentXid();
-		originalServer.storeRootTransaction();
-		transactionManager.suspend();
-		performTransactionalWork(nodesToFlowTo, remainingTimeout, currentXid);
-		transactionManager.resume(originalTransaction);
-		originalServer.removeRootTransaction(currentXid);
-		originalTransaction.commit();
-		Thread.currentThread().setContextClassLoader(classLoader);
+	@Test
+	public void testMigrateTransactionCommitDiamond() throws NotSupportedException, SystemException, IllegalStateException, RollbackException,
+			InvalidTransactionException, XAException, SecurityException, HeuristicMixedException, HeuristicRollbackException {
+
+		File file = new File(System.getProperty("user.dir") + "/tmp/");
+		if (file.exists()) {
+			file.delete();
+		}
+		int startingTimeout = 0;
+		List<Integer> nodesToFlowTo = new LinkedList<Integer>(Arrays.asList(new Integer[] { 1000, 2000, 1000, 3000, 1000, 2000, 3000 }));
+		doRecursiveTransactionalWork(startingTimeout, nodesToFlowTo, true);
 	}
 
 	@Test
+	public void testMigrateTransactionRollback() throws NotSupportedException, SystemException, IllegalStateException, RollbackException,
+			InvalidTransactionException, XAException, SecurityException, HeuristicMixedException, HeuristicRollbackException {
+
+		File file = new File(System.getProperty("user.dir") + "/tmp/");
+		if (file.exists()) {
+			file.delete();
+		}
+		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 {
+
+		File file = new File(System.getProperty("user.dir") + "/tmp/");
+		if (file.exists()) {
+			file.delete();
+		}
+		int startingTimeout = 0;
+		List<Integer> nodesToFlowTo = new LinkedList<Integer>(Arrays.asList(new Integer[] { 1000, 2000, 1000, 3000, 1000, 2000, 3000 }));
+		doRecursiveTransactionalWork(startingTimeout, nodesToFlowTo, false);
+	}
+
+	@Test
 	public void testMigrateTransactionSubordinateTimeout() throws NotSupportedException, SystemException, IllegalStateException, RollbackException,
 			InvalidTransactionException, XAException, SecurityException, HeuristicMixedException, HeuristicRollbackException, InterruptedException {
 
@@ -95,6 +128,37 @@
 		int subordinateTimeout = 1;
 
 		// Start out at the first server
+		CompletionCounter counter = new CompletionCounter() {
+			private int commitCount = 0;
+			private int rollbackCount = 0;
+
+			@Override
+			public void incrementCommit() {
+				commitCount++;
+
+			}
+
+			@Override
+			public void incrementRollback() {
+				rollbackCount++;
+			}
+
+			@Override
+			public int getCommitCount() {
+				return commitCount;
+			}
+
+			@Override
+			public int getRollbackCount() {
+				return rollbackCount;
+			}
+
+			@Override
+			public void resetCounters() {
+				commitCount = 0;
+				rollbackCount = 0;
+			}
+		};
 		LocalServer originalServer = getLocalServer(1000);
 		ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
 		Thread.currentThread().setContextClassLoader(originalServer.getClass().getClassLoader());
@@ -104,8 +168,7 @@
 		Transaction originalTransaction = transactionManager.getTransaction();
 		Xid toMigrate = originalServer.getCurrentXid();
 		originalServer.storeRootTransaction();
-		Transaction transaction = transactionManager.getTransaction();
-		transaction.enlistResource(new TestResource(originalServer.getNodeName(), false));
+		originalTransaction.enlistResource(new TestResource(counter, originalServer.getNodeName(), false));
 		transactionManager.suspend();
 
 		// Migrate a transaction
@@ -113,27 +176,90 @@
 		ClassLoader parentsClassLoader = Thread.currentThread().getContextClassLoader();
 		Thread.currentThread().setContextClassLoader(currentServer.getClass().getClassLoader());
 		currentServer.getAndResumeTransaction(subordinateTimeout, toMigrate);
-		currentServer.getTransactionManager().getTransaction().enlistResource(new TestResource(currentServer.getNodeName(), false));
+		currentServer.getTransactionManager().getTransaction().enlistResource(new TestResource(counter, currentServer.getNodeName(), false));
 		currentServer.getTransactionManager().suspend();
 		Thread.currentThread().setContextClassLoader(parentsClassLoader);
 
 		// Complete the transaction at the original server
-		transactionManager.resume(transaction);
+		transactionManager.resume(originalTransaction);
 		XAResource proxyXAResource = originalServer.generateProxyXAResource(lookupProvider, originalServer.getNodeName(), 2000);
-		transaction.enlistResource(proxyXAResource);
+		originalTransaction.enlistResource(proxyXAResource);
 		originalServer.removeRootTransaction(toMigrate);
 		Thread.currentThread().sleep((subordinateTimeout + 1) * 1000);
 		try {
-			originalTransaction.commit();
+			transactionManager.commit();
 		} catch (RollbackException rbe) {
 			// GOOD!
+			assertTrue(counter.getRollbackCount() == 2);
 		} finally {
 			Thread.currentThread().setContextClassLoader(classLoader);
 		}
 	}
 
-	private boolean performTransactionalWork(List<Integer> nodesToFlowTo, int remainingTimeout, Xid toMigrate) throws RollbackException,
-			InvalidTransactionException, IllegalStateException, XAException, SystemException, NotSupportedException {
+	private void doRecursiveTransactionalWork(int startingTimeout, List<Integer> nodesToFlowTo, boolean commit) throws NotSupportedException, SystemException,
+			RollbackException, InvalidTransactionException, IllegalStateException, XAException, SecurityException, HeuristicMixedException,
+			HeuristicRollbackException {
+
+		// Start out at the first server
+		CompletionCounter counter = new CompletionCounter() {
+			private int commitCount = 0;
+			private int rollbackCount = 0;
+
+			@Override
+			public void incrementCommit() {
+				commitCount++;
+
+			}
+
+			@Override
+			public void incrementRollback() {
+				rollbackCount++;
+			}
+
+			@Override
+			public int getCommitCount() {
+				return commitCount;
+			}
+
+			@Override
+			public int getRollbackCount() {
+				return rollbackCount;
+			}
+
+			@Override
+			public void resetCounters() {
+				commitCount = 0;
+				rollbackCount = 0;
+			}
+		};
+		int totalNodeCount = nodesToFlowTo.size();
+		int startingServer = nodesToFlowTo.get(0);
+		LocalServer originalServer = getLocalServer(startingServer);
+		ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+		Thread.currentThread().setContextClassLoader(originalServer.getClass().getClassLoader());
+		TransactionManager transactionManager = originalServer.getTransactionManager();
+		transactionManager.setTransactionTimeout(startingTimeout);
+		transactionManager.begin();
+		Transaction originalTransaction = transactionManager.getTransaction();
+		int remainingTimeout = (int) (originalServer.getTimeLeftBeforeTransactionTimeout() / 1000);
+		Xid currentXid = originalServer.getCurrentXid();
+		originalServer.storeRootTransaction();
+		transactionManager.suspend();
+		performTransactionalWork(counter, nodesToFlowTo, remainingTimeout, currentXid);
+		transactionManager.resume(originalTransaction);
+		originalServer.removeRootTransaction(currentXid);
+		if (commit) {
+			transactionManager.commit();
+			assertTrue(counter.getCommitCount() == totalNodeCount);
+		} else {
+			transactionManager.rollback();
+			assertTrue(counter.getRollbackCount() == totalNodeCount);
+		}
+		Thread.currentThread().setContextClassLoader(classLoader);
+	}
+
+	private boolean performTransactionalWork(CompletionCounter counter, List<Integer> nodesToFlowTo, int remainingTimeout, Xid toMigrate)
+			throws RollbackException, InvalidTransactionException, IllegalStateException, XAException, SystemException, NotSupportedException {
 		Integer currentServerName = nodesToFlowTo.remove(0);
 		LocalServer currentServer = getLocalServer(currentServerName);
 
@@ -145,7 +271,7 @@
 		TransactionManager transactionManager = currentServer.getTransactionManager();
 		Transaction transaction = transactionManager.getTransaction();
 		transaction.registerSynchronization(new TestSynchronization(currentServer.getNodeName()));
-		transaction.enlistResource(new TestResource(currentServer.getNodeName(), false));
+		transaction.enlistResource(new TestResource(counter, currentServer.getNodeName(), false));
 
 		if (!nodesToFlowTo.isEmpty()) {
 			Integer nextServerNodeName = nodesToFlowTo.get(0);
@@ -156,7 +282,7 @@
 			// SUSPEND THE TRANSACTION
 			Xid currentXid = currentServer.getCurrentXid();
 			transactionManager.suspend();
-			boolean proxyRequired = performTransactionalWork(nodesToFlowTo, remainingTimeout, currentXid);
+			boolean proxyRequired = performTransactionalWork(counter, nodesToFlowTo, remainingTimeout, currentXid);
 			transactionManager.resume(transaction);
 
 			// Create a proxy for the new server if necessary, this can orphan

Modified: labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/TestResource.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/TestResource.java	2011-10-17 22:21:29 UTC (rev 37583)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/TestResource.java	2011-10-18 07:46:56 UTC (rev 37584)
@@ -34,6 +34,7 @@
 import javax.transaction.xa.Xid;
 
 import com.arjuna.ats.arjuna.common.Uid;
+import com.arjuna.ats.jta.distributed.server.CompletionCounter;
 
 public class TestResource implements XAResource {
 	private Xid xid;
@@ -46,12 +47,16 @@
 
 	private int serverId;
 
-	public TestResource(int serverId, boolean readonly) {
+	private CompletionCounter completionCounter;
+
+	public TestResource(CompletionCounter completionCounter, int serverId, boolean readonly) {
+		this.completionCounter = completionCounter;
 		this.serverId = serverId;
 		this.readonly = readonly;
 	}
 
-	public TestResource(int serverId, File file) throws IOException {
+	public TestResource(CompletionCounter completionCounter, int serverId, File file) throws IOException {
+		this.completionCounter = completionCounter;
 		this.serverId = serverId;
 		this.file = file;
 		DataInputStream fis = new DataInputStream(new FileInputStream(file));
@@ -116,6 +121,9 @@
 
 	public synchronized void commit(Xid id, boolean onePhase) throws XAException {
 		System.out.println("        TestResource (" + serverId + ")      XA_COMMIT  [" + id + "]");
+		if (completionCounter != null) {
+			completionCounter.incrementCommit();
+		}
 		// String absoluteFile = file.getAbsolutePath();
 		// String newName = absoluteFile.substring(0, absoluteFile.length() -
 		// 1);
@@ -129,6 +137,9 @@
 
 	public synchronized void rollback(Xid xid) throws XAException {
 		System.out.println("        TestResource (" + serverId + ")      XA_ROLLBACK[" + xid + "]");
+		if (completionCounter != null) {
+			completionCounter.incrementRollback();
+		}
 		if (file != null) {
 			file.delete();
 		}

Modified: labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/TestResourceRecovery.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/TestResourceRecovery.java	2011-10-17 22:21:29 UTC (rev 37583)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/TestResourceRecovery.java	2011-10-18 07:46:56 UTC (rev 37584)
@@ -9,18 +9,20 @@
 
 import org.jboss.tm.XAResourceRecovery;
 
+import com.arjuna.ats.jta.distributed.server.CompletionCounter;
+
 public class TestResourceRecovery implements XAResourceRecovery {
 
 	private List<TestResource> resources = new ArrayList<TestResource>();
 
-	public TestResourceRecovery(int serverId) throws IOException {
-		File file = new File(System.getProperty("user.dir") + "/tmp/TestResource/" + serverId + "/");
+	public TestResourceRecovery(CompletionCounter counter, Integer nodeName) throws IOException {
+		File file = new File(System.getProperty("user.dir") + "/tmp/TestResource/" + nodeName + "/");
 		if (file.exists() && file.isDirectory()) {
 			File[] listFiles = file.listFiles();
 			for (int i = 0; i < listFiles.length; i++) {
 				File currentFile = listFiles[i];
 				if (currentFile.getAbsolutePath().endsWith("_")) {
-					resources.add(new TestResource(serverId, currentFile));
+					resources.add(new TestResource(counter, nodeName, currentFile));
 				}
 			}
 		}

Added: labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/server/CompletionCounter.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/server/CompletionCounter.java	                        (rev 0)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/server/CompletionCounter.java	2011-10-18 07:46:56 UTC (rev 37584)
@@ -0,0 +1,9 @@
+package com.arjuna.ats.jta.distributed.server;
+
+public interface CompletionCounter {
+	public void incrementCommit();
+	public void incrementRollback();
+	int getCommitCount();
+	int getRollbackCount();
+	void resetCounters();
+}

Modified: labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/server/LocalServer.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/server/LocalServer.java	2011-10-17 22:21:29 UTC (rev 37583)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/server/LocalServer.java	2011-10-18 07:46:56 UTC (rev 37584)
@@ -43,4 +43,6 @@
 	public Xid extractXid(XAResource proxyXAResource);
 
 	public Xid getCurrentXid() throws SystemException;
+
+	public CompletionCounter getCompletionCounter();
 }

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-17 22:21:29 UTC (rev 37583)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/tests/classes/com/arjuna/ats/jta/distributed/server/impl/ServerImpl.java	2011-10-18 07:46:56 UTC (rev 37584)
@@ -38,12 +38,11 @@
 import com.arjuna.ats.jbossatx.jta.TransactionManagerService;
 import com.arjuna.ats.jta.common.JTAEnvironmentBean;
 import com.arjuna.ats.jta.distributed.TestResourceRecovery;
+import com.arjuna.ats.jta.distributed.server.CompletionCounter;
 import com.arjuna.ats.jta.distributed.server.DummyRemoteException;
 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 {
 
@@ -54,19 +53,51 @@
 	private LookupProvider lookupProvider;
 	private Map<SubordinateXidImple, TransactionImple> transactions = new HashMap<SubordinateXidImple, TransactionImple>();
 	private RecoveryManager _recoveryManager;
+	private CompletionCounter counter;
 
-	public void initialise(LookupProvider lookupProvider, Integer serverName) throws CoreEnvironmentBeanException, IOException, SecurityException,
+	public void initialise(LookupProvider lookupProvider, Integer nodeName) throws CoreEnvironmentBeanException, IOException, SecurityException,
 			NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
 		this.lookupProvider = lookupProvider;
-		this.nodeName = serverName;
+		this.nodeName = nodeName;
+		this.counter = new CompletionCounter() {
+			private int commitCount = 0;
+			private int rollbackCount = 0;
 
+			@Override
+			public void incrementCommit() {
+				commitCount++;
+
+			}
+
+			@Override
+			public void incrementRollback() {
+				rollbackCount++;
+			}
+
+			@Override
+			public int getCommitCount() {
+				return commitCount;
+			}
+
+			@Override
+			public int getRollbackCount() {
+				return rollbackCount;
+			}
+
+			@Override
+			public void resetCounters() {
+				commitCount = 0;
+				rollbackCount = 0;
+			}
+		};
+
 		RecoveryEnvironmentBean recoveryEnvironmentBean = com.arjuna.ats.arjuna.common.recoveryPropertyManager.getRecoveryEnvironmentBean();
 		recoveryEnvironmentBean.setRecoveryBackoffPeriod(1);
 
 		recoveryEnvironmentBean.setRecoveryInetAddress(InetAddress.getByName("localhost"));
-		recoveryEnvironmentBean.setRecoveryPort(4712 + serverName);
+		recoveryEnvironmentBean.setRecoveryPort(4712 + nodeName);
 		recoveryEnvironmentBean.setTransactionStatusManagerInetAddress(InetAddress.getByName("localhost"));
-		recoveryEnvironmentBean.setTransactionStatusManagerPort(4713 + serverName);
+		recoveryEnvironmentBean.setTransactionStatusManagerPort(4713 + nodeName);
 		List<String> recoveryModuleClassNames = new ArrayList<String>();
 
 		recoveryModuleClassNames.add("com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule");
@@ -79,8 +110,8 @@
 		recoveryEnvironmentBean.setRecoveryActivators(null);
 
 		CoreEnvironmentBean coreEnvironmentBean = com.arjuna.ats.arjuna.common.arjPropertyManager.getCoreEnvironmentBean();
-		coreEnvironmentBean.setSocketProcessIdPort(4714 + serverName);
-		coreEnvironmentBean.setNodeIdentifier(serverName);
+		coreEnvironmentBean.setSocketProcessIdPort(4714 + nodeName);
+		coreEnvironmentBean.setNodeIdentifier(nodeName);
 		coreEnvironmentBean.setSocketProcessIdMaxPorts(1);
 
 		CoordinatorEnvironmentBean coordinatorEnvironmentBean = com.arjuna.ats.arjuna.common.arjPropertyManager.getCoordinatorEnvironmentBean();
@@ -91,15 +122,15 @@
 
 		ObjectStoreEnvironmentBean actionStoreObjectStoreEnvironmentBean = com.arjuna.common.internal.util.propertyservice.BeanPopulator.getNamedInstance(
 				com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.class, "default");
-		actionStoreObjectStoreEnvironmentBean.setObjectStoreDir(System.getProperty("user.dir") + "/tmp/tx-object-store/" + serverName);
+		actionStoreObjectStoreEnvironmentBean.setObjectStoreDir(System.getProperty("user.dir") + "/tmp/tx-object-store/" + nodeName);
 
 		ObjectStoreEnvironmentBean stateStoreObjectStoreEnvironmentBean = com.arjuna.common.internal.util.propertyservice.BeanPopulator.getNamedInstance(
 				com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.class, "stateStore");
-		stateStoreObjectStoreEnvironmentBean.setObjectStoreDir(System.getProperty("user.dir") + "/tmp/tx-object-store/" + serverName);
+		stateStoreObjectStoreEnvironmentBean.setObjectStoreDir(System.getProperty("user.dir") + "/tmp/tx-object-store/" + nodeName);
 
 		ObjectStoreEnvironmentBean communicationStoreObjectStoreEnvironmentBean = com.arjuna.common.internal.util.propertyservice.BeanPopulator
 				.getNamedInstance(com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.class, "communicationStore");
-		communicationStoreObjectStoreEnvironmentBean.setObjectStoreDir(System.getProperty("user.dir") + "/tmp/tx-object-store/" + serverName);
+		communicationStoreObjectStoreEnvironmentBean.setObjectStoreDir(System.getProperty("user.dir") + "/tmp/tx-object-store/" + nodeName);
 
 		ObjStoreBrowser objStoreBrowser = new ObjStoreBrowser();
 		Map<String, String> types = new HashMap<String, String>();
@@ -113,7 +144,7 @@
 		jTAEnvironmentBean
 				.setTransactionSynchronizationRegistryClassName("com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple");
 		List<Integer> xaRecoveryNodes = new ArrayList<Integer>();
-		xaRecoveryNodes.add(serverName);
+		xaRecoveryNodes.add(nodeName);
 		jTAEnvironmentBean.setXaRecoveryNodes(xaRecoveryNodes);
 
 		List<String> xaResourceOrphanFilterClassNames = new ArrayList<String>();
@@ -126,8 +157,9 @@
 
 		recoveryManagerService = new RecoveryManagerService();
 		recoveryManagerService.create();
-		recoveryManagerService.addXAResourceRecovery(new ProxyXAResourceRecovery(lookupProvider, serverName));
-		recoveryManagerService.addXAResourceRecovery(new TestResourceRecovery(serverName));
+		recoveryManagerService.addXAResourceRecovery(new ProxyXAResourceRecovery(lookupProvider, nodeName));
+		recoveryManagerService.addXAResourceRecovery(new TestResourceRecovery(counter, nodeName));
+		
 		// recoveryManagerService.start();
 		_recoveryManager = RecoveryManager.manager();
 		RecoveryManager.manager().initialize();
@@ -152,6 +184,7 @@
 		ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
 		ClassLoader serversClassLoader = this.getClass().getClassLoader();
 		Thread.currentThread().setContextClassLoader(serversClassLoader);
+
 		_recoveryManager.scan();
 		Thread.currentThread().setContextClassLoader(classLoader);
 	}
@@ -234,8 +267,7 @@
 		if (offline) {
 			throw new DummyRemoteException("Connection refused to: " + nodeName);
 		}
-		SubordinateTransaction tx = SubordinationManager
-                .getTransactionImporter().getImportedTransaction(xid);
+		SubordinateTransaction tx = SubordinationManager.getTransactionImporter().getImportedTransaction(xid);
 		return SubordinationManager.getXATerminator().prepare(xid);
 	}
 
@@ -295,4 +327,9 @@
 		ProxyXAResource proxyXAResource = (ProxyXAResource) xaResource;
 		return proxyXAResource.getXid();
 	}
+
+	@Override
+	public CompletionCounter getCompletionCounter() {
+		return counter;
+	}
 }



More information about the jboss-svn-commits mailing list