[jboss-svn-commits] JBL Code SVN: r9088 - labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/jca.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Jan 29 17:07:34 EST 2007


Author: mark.little at jboss.com
Date: 2007-01-29 17:07:34 -0500 (Mon, 29 Jan 2007)
New Revision: 9088

Modified:
   labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/jca/TxImporter.java
Log:
Added recovery support.

Modified: labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/jca/TxImporter.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/jca/TxImporter.java	2007-01-29 22:06:18 UTC (rev 9087)
+++ labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/jca/TxImporter.java	2007-01-29 22:07:34 UTC (rev 9088)
@@ -36,7 +36,10 @@
 
 import javax.transaction.xa.*;
 
+import com.arjuna.ats.arjuna.common.Uid;
 import com.arjuna.ats.internal.jta.transaction.jts.subordinate.jca.TransactionImple;
+import com.arjuna.ats.jta.utils.XAHelper;
+import com.arjuna.ats.jta.xa.XidImple;
 
 public class TxImporter
 {
@@ -73,7 +76,7 @@
 	public static TransactionImple importTransaction (Xid xid, int timeout) throws XAException
 	{
 		if (xid == null)
-			throw new InvalidParameterException();
+			throw new IllegalArgumentException();
 		
 		/*
 		 * Check to see if we haven't already imported this thing.
@@ -85,12 +88,31 @@
 		{	
 			imported = new TransactionImple(timeout, xid);
 			
-			_transactions.put(xid, imported);
+			_transactions.put(new XidImple(xid), imported);
 		}
 		
 		return imported;
 	}
 
+	public static TransactionImple recoverTransaction (Uid actId) throws XAException
+	{
+		if (actId == null)
+			throw new IllegalArgumentException();
+		
+		TransactionImple recovered = new TransactionImple(actId);
+		TransactionImple tx = (TransactionImple) _transactions.get(recovered.baseXid());
+
+		if (tx == null)
+		{
+			recovered.recordTransaction();
+
+			_transactions.put(recovered.baseXid(), recovered);
+			
+			return recovered;
+		}
+		else
+			return tx;
+	}
 	/**
 	 * Get the subordinate (imported) transaction associated with the
 	 * global transaction.
@@ -106,9 +128,9 @@
 	public static TransactionImple getImportedTransaction (Xid xid) throws XAException
 	{
 		if (xid == null)
-			throw new InvalidParameterException();
+			throw new IllegalArgumentException();
 		
-		return (TransactionImple) _transactions.get(xid);
+		return (TransactionImple) _transactions.get(new XidImple(xid));
 	}
 
 	/**
@@ -122,9 +144,9 @@
 	public static void removeImportedTransaction (Xid xid) throws XAException
 	{
 		if (xid == null)
-			throw new InvalidParameterException();
-		
-		_transactions.remove(xid);
+			throw new IllegalArgumentException();
+
+		_transactions.remove(new XidImple(xid));
 	}
 	
 	private static HashMap _transactions = new HashMap();




More information about the jboss-svn-commits mailing list