[jboss-svn-commits] JBL Code SVN: r16347 - in labs/jbosstm/trunk: ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Nov 5 10:38:39 EST 2007


Author: adinn
Date: 2007-11-05 10:38:39 -0500 (Mon, 05 Nov 2007)
New Revision: 16347

Modified:
   labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/TransactionImple.java
   labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/TransactionImple.java
Log:
patched trunk for JBTM-245

Modified: labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/TransactionImple.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/TransactionImple.java	2007-11-05 15:35:09 UTC (rev 16346)
+++ labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/TransactionImple.java	2007-11-05 15:38:39 UTC (rev 16347)
@@ -1506,13 +1506,13 @@
 
 			if (el != null)
 			{
-				while (el.hasMoreElements())
+				try
 				{
 					/*
 					 * Would it gain us much to just loop for _suspendCount?
 					 */
 
-					try
+					while (el.hasMoreElements())
 					{
 						/*
 						 * Get the XAResource in case we have to call end on it.
@@ -1530,17 +1530,62 @@
 							info.setState(TxInfo.NOT_ASSOCIATED);
 						}
 					}
-					catch (XAException ex)
+				}
+				catch (XAException ex)
+				{
+					if (jtaLogger.loggerI18N.isWarnEnabled())
 					{
-					        if (jtaLogger.loggerI18N.isWarnEnabled())
+						jtaLogger.loggerI18N
+								.warn("com.arjuna.ats.internal.jta.transaction.arjunacore.xaenderror");
+					}
+
+					result = false;
+				}
+			}
+
+			/*
+			 * need to do the same for all duplicated resources
+			 */
+
+			el = _duplicateResources.keys();
+
+			if (el != null)
+			{
+				try
+				{
+					/*
+					 * Would it gain us much to just loop for _suspendCount?
+					 */
+
+					while (el.hasMoreElements())
+					{
+						/*
+						 * Get the XAResource in case we have to call end on it.
+						 */
+
+						XAResource xaRes = (XAResource) el.nextElement();
+						TxInfo info = (TxInfo) _duplicateResources.get(xaRes);
+
+						if (info.getState() == TxInfo.ASSOCIATION_SUSPENDED)
 						{
-						    jtaLogger.loggerI18N
-								.warn("com.arjuna.ats.internal.jta.transaction.arjunacore.xaenderror");
+							if (XAUtils.mustEndSuspendedRMs(xaRes))
+								xaRes.start(info.xid(), XAResource.TMRESUME);
+
+							xaRes.end(info.xid(), XAResource.TMSUCCESS);
+							info.setState(TxInfo.NOT_ASSOCIATED);
 						}
-
-						result = false;
 					}
 				}
+				catch (XAException ex)
+				{
+					if (jtaLogger.loggerI18N.isWarnEnabled())
+					{
+						jtaLogger.loggerI18N
+								.warn("com.arjuna.ats.internal.jta.transaction.arjunacore.xaenderror");
+					}
+
+					result = false;
+				}
 			}
 
 			_suspendCount = 0;

Modified: labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/TransactionImple.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/TransactionImple.java	2007-11-05 15:35:09 UTC (rev 16346)
+++ labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/TransactionImple.java	2007-11-05 15:38:39 UTC (rev 16347)
@@ -1448,9 +1448,9 @@
 
 			if (el != null)
 			{
-				while (el.hasMoreElements())
+				try
 				{
-					try
+					while (el.hasMoreElements())
 					{
 						/*
 						 * Get the XAResource in case we have to call end on it.
@@ -1468,19 +1468,59 @@
 							info.setState(TxInfo.NOT_ASSOCIATED);
 						}
 					}
-					catch (XAException ex)
+				}
+				catch (XAException ex)
+				{
+					if (jtaLogger.loggerI18N.isWarnEnabled())
 					{
-					        if (jtaLogger.loggerI18N.isWarnEnabled())
+						jtaLogger.loggerI18N.warn("com.arjuna.ats.internal.jta.transaction.jts.xaenderror");
+					}
+
+					result = false;
+				}
+			}
+
+			/*
+			 * do the same again for duplicate resources
+			 */
+
+			el = _duplicateResources.keys();
+
+			if (el != null)
+			{
+				try
+				{
+					while (el.hasMoreElements())
+					{
+						/*
+						 * Get the XAResource in case we have to call end on it.
+						 */
+
+						XAResource xaRes = (XAResource) el.nextElement();
+						TxInfo info = (TxInfo) _duplicateResources.get(xaRes);
+
+						if (info.getState() == TxInfo.ASSOCIATION_SUSPENDED)
 						{
-						        jtaLogger.loggerI18N.warn("com.arjuna.ats.internal.jta.transaction.jts.xaenderror");
+							if (XAUtils.mustEndSuspendedRMs(xaRes))
+								xaRes.start(info.xid(), XAResource.TMRESUME);
+
+							xaRes.end(info.xid(), XAResource.TMSUCCESS);
+							info.setState(TxInfo.NOT_ASSOCIATED);
 						}
-
-						result = false;
 					}
 				}
+				catch (XAException ex)
+				{
+					if (jtaLogger.loggerI18N.isWarnEnabled())
+					{
+						jtaLogger.loggerI18N.warn("com.arjuna.ats.internal.jta.transaction.jts.xaenderror");
+					}
+
+					result = false;
+				}
 			}
 
-			_suspendCount = 0;
+            _suspendCount = 0;
 		}
 
 		return result;




More information about the jboss-svn-commits mailing list