[jboss-svn-commits] JBL Code SVN: r18743 - labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/resources/arjunacore.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Mar 6 17:50:11 EST 2008


Author: mark.little at jboss.com
Date: 2008-03-06 17:50:11 -0500 (Thu, 06 Mar 2008)
New Revision: 18743

Modified:
   labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/resources/arjunacore/XAResourceRecord.java
Log:
http://jira.jboss.com/jira/browse/JBTM-278

Modified: labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/resources/arjunacore/XAResourceRecord.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/resources/arjunacore/XAResourceRecord.java	2008-03-06 22:49:56 UTC (rev 18742)
+++ labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/resources/arjunacore/XAResourceRecord.java	2008-03-06 22:50:11 UTC (rev 18743)
@@ -310,7 +310,7 @@
 			case XAException.XAER_INVAL:
 			case XAException.XAER_PROTO:
 			case XAException.XAER_NOTA: // resource may have arbitrarily rolled back (shouldn't, but ...)
-				return TwoPhaseOutcome.PREPARE_NOTOK;
+				return TwoPhaseOutcome.PREPARE_NOTOK;  // will not call rollback
 			default:
 				return TwoPhaseOutcome.HEURISTIC_HAZARD; // we're not really sure (shouldn't get here though).
 			}
@@ -397,7 +397,27 @@
 							_theXAResource.end(_tranID, XAResource.TMSUCCESS);
 						}
 					}
-
+				}
+				catch (XAException e1)
+				{
+				    if ((e1.errorCode >= XAException.XA_RBBASE)
+						&& (e1.errorCode < XAException.XA_RBEND))
+				    {
+					/*
+					 * Has been marked as rollback-only. We still
+					 * need to call rollback.
+					 */
+				    }
+				    else
+				    {
+					removeConnection();
+					
+					return TwoPhaseOutcome.FINISH_ERROR;
+				    }
+				}
+				
+				try
+				{
 					_theXAResource.rollback(_tranID);
 				}
 				catch (XAException e1)
@@ -536,6 +556,11 @@
 				if (_heuristic != TwoPhaseOutcome.FINISH_OK)
 					return _heuristic;
 
+				/*
+				 * No need for end call here since we can only get to this
+				 * point by going through prepare.
+				 */
+				
 				try
 				{
 					_theXAResource.commit(_tranID, false);
@@ -701,6 +726,8 @@
 				if (_heuristic != TwoPhaseOutcome.FINISH_OK)
 					return _heuristic;
 
+				boolean commit = true;
+				
 				try
 				{
 					/*
@@ -712,8 +739,38 @@
 					{
 						_theXAResource.end(_tranID, XAResource.TMSUCCESS);
 					}
-
+				}
+				catch (XAException e1)
+				{
+				    if ((e1.errorCode >= XAException.XA_RBBASE)
+						&& (e1.errorCode < XAException.XA_RBEND))
+				    {
+					/*
+					 * Has been marked as rollback-only. We still
+					 * need to call rollback.
+					 */
+					
+					commit = false;
+				    }
+				    else
+				    {
+					removeConnection();
+					
+					return TwoPhaseOutcome.FINISH_ERROR;
+				    }
+				}
+				
+				try
+				{
+				    /*
+				     * Not strictly necessary since calling commit will
+				     * do the rollback if end failed as above.
+				     */
+				    
+				    if (commit)
 					_theXAResource.commit(_tranID, true);
+				    else
+					_theXAResource.rollback(_tranID);
 				}
 				catch (XAException e1)
 				{
@@ -723,12 +780,6 @@
 					 * XAER_PROTO. XA_RB*
 					 */
 
-					if ((e1.errorCode >= XAException.XA_RBBASE)
-							&& (e1.errorCode < XAException.XA_RBEND))
-					{
-						return TwoPhaseOutcome.FINISH_ERROR;
-					}
-
 					switch (e1.errorCode)
 					{
 					case XAException.XA_HEURHAZ:




More information about the jboss-svn-commits mailing list