[jboss-svn-commits] JBL Code SVN: r29335 - in labs/jbosstm/trunk: ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/resources/arjunacore and 2 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Sep 14 10:29:09 EDT 2009


Author: mark.little at jboss.com
Date: 2009-09-14 10:29:09 -0400 (Mon, 14 Sep 2009)
New Revision: 29335

Modified:
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/BasicAction.java
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TwoPhaseOutcome.java
   labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/resources/arjunacore/XAResourceRecord.java
   labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/resources/jts/orbspecific/XAResourceRecord.java
   labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/resources/ExtendedResourceRecord.java
   labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/resources/ResourceRecord.java
Log:
https://jira.jboss.org/jira/browse/JBTM-605

Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/BasicAction.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/BasicAction.java	2009-09-14 13:34:05 UTC (rev 29334)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/BasicAction.java	2009-09-14 14:29:09 UTC (rev 29335)
@@ -2704,15 +2704,30 @@
 		}
 		else
 		{
-			if (p == TwoPhaseOutcome.FINISH_ERROR)
+			if ((p == TwoPhaseOutcome.FINISH_ERROR) || (p == TwoPhaseOutcome.ONE_PHASE_ERROR))
 			{
-			    if (!failedList.insert(recordBeingHandled))
-                                recordBeingHandled = null;
-                            else
-                            {
-                                if (!stateToSave)
-                                    stateToSave = recordBeingHandled.doSave();
-                            }
+			    /*
+			     * If ONE_PHASE_ERROR then the resource has rolled back. Otherwise we
+			     * don't know and will ask recovery to keep trying.
+			     */
+			    
+			    if (p == TwoPhaseOutcome.FINISH_ERROR)
+			    {
+        			    /*
+        			     * We still add to the failed list because this may not mean
+        			     * that the transaction has aborted.
+        			     */
+        			    
+        			    if (!failedList.insert(recordBeingHandled))
+                                        recordBeingHandled = null;
+                                    else
+                                    {
+                                        if (!stateToSave)
+                                            stateToSave = recordBeingHandled.doSave();
+                                    }
+			    }
+			    else			    
+			        actionStatus = ActionStatus.ABORTED;
 			}
 			else
 			{

Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TwoPhaseOutcome.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TwoPhaseOutcome.java	2009-09-14 13:34:05 UTC (rev 29334)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TwoPhaseOutcome.java	2009-09-14 14:29:09 UTC (rev 29335)
@@ -48,7 +48,7 @@
  * @since JTS 1.0.
  */
 
-// TODO this needs extending.
+// TODO this needs extending so that one-phase can return rollback directly.
 
 public class TwoPhaseOutcome
 {
@@ -63,7 +63,7 @@
     public static final int FINISH_OK = 7;
     public static final int FINISH_ERROR = 8;
     public static final int NOT_PREPARED = 9;
-    public static final int ONE_PHASE_ERROR = 10;
+    public static final int ONE_PHASE_ERROR = 10;  // WARNING this has different meanings depending upon nested or top-level usage.
     public static final int INVALID_TRANSACTION = 11;
 
     public TwoPhaseOutcome (int outcome)

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	2009-09-14 13:34:05 UTC (rev 29334)
+++ labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/resources/arjunacore/XAResourceRecord.java	2009-09-14 14:29:09 UTC (rev 29335)
@@ -727,198 +727,198 @@
 
 	public int topLevelOnePhaseCommit()
 	{
-		if (jtaLogger.logger.isDebugEnabled())
-		{
-			jtaLogger.logger.debug(DebugLevel.FUNCTIONS,
-					VisibilityLevel.VIS_PUBLIC,
-					com.arjuna.ats.jta.logging.FacilityCode.FAC_JTA,
-					"XAResourceRecord.topLevelOnePhaseCommit for " + _tranID);
-		}
+	    if (jtaLogger.logger.isDebugEnabled())
+	    {
+	        jtaLogger.logger.debug(DebugLevel.FUNCTIONS,
+	                VisibilityLevel.VIS_PUBLIC,
+	                com.arjuna.ats.jta.logging.FacilityCode.FAC_JTA,
+	                "XAResourceRecord.topLevelOnePhaseCommit for " + _tranID);
+	    }
 
-		if (_tranID == null)
-		{
-			if (jtaLogger.loggerI18N.isWarnEnabled())
-			{
-				jtaLogger.loggerI18N
-						.warn(
-								"com.arjuna.ats.internal.jta.resources.arjunacore.opcnulltx",
-								new Object[]
-								{ "XAResourceRecord.1pc" });
-			}
+	    if (_tranID == null)
+	    {
+	        if (jtaLogger.loggerI18N.isWarnEnabled())
+	        {
+	            jtaLogger.loggerI18N
+	            .warn(
+	                    "com.arjuna.ats.internal.jta.resources.arjunacore.opcnulltx",
+	                    new Object[]
+	                               { "XAResourceRecord.1pc" });
+	        }
 
-			return TwoPhaseOutcome.FINISH_ERROR;
-		}
-		else
-		{
-			if (_theXAResource != null)
-			{
-				if (_heuristic != TwoPhaseOutcome.FINISH_OK)
-					return _heuristic;
+	        return TwoPhaseOutcome.ONE_PHASE_ERROR;  // rolled back!!
+	    }
+	    else
+	    {
+	        if (_theXAResource != null)
+	        {
+	            if (_heuristic != TwoPhaseOutcome.FINISH_OK)
+	                return _heuristic;
 
-				boolean commit = true;
-				XAException endHeuristic = null;
+	            boolean commit = true;
+	            XAException endHeuristic = null;
 
-				try
-				{
-					/*
-					 * TODO in Oracle the end is not needed. Is this common
-					 * across other RMs?
-					 */
+	            try
+	            {
+	                /*
+	                 * TODO in Oracle the end is not needed. Is this common
+	                 * across other RMs?
+	                 */
 
-					if (endAssociation())
-					{
-						_theXAResource.end(_tranID, XAResource.TMSUCCESS);
-					}
-				}
-				catch (XAException e1)
-				{
-				    /*
-				     * Now it's not legal to return a heuristic from end, but
-				     * apparently Oracle does (http://jira.jboss.com/jira/browse/JBTM-343)
-				     * Since this is 1PC we can call forget: the outcome of the
-				     * transaction is the outcome of the participant.
-				     */
+	                if (endAssociation())
+	                {
+	                    _theXAResource.end(_tranID, XAResource.TMSUCCESS);
+	                }
+	            }
+	            catch (XAException e1)
+	            {
+	                /*
+	                 * Now it's not legal to return a heuristic from end, but
+	                 * apparently Oracle does (http://jira.jboss.com/jira/browse/JBTM-343)
+	                 * Since this is 1PC we can call forget: the outcome of the
+	                 * transaction is the outcome of the participant.
+	                 */
 
-				    switch (e1.errorCode)
-				    {
-				    case XAException.XA_HEURHAZ:
-				    case XAException.XA_HEURMIX:
-				    case XAException.XA_HEURCOM:
-				    case XAException.XA_HEURRB:
-					endHeuristic = e1;
-					break;
-				    case XAException.XA_RBROLLBACK:
-				    case XAException.XA_RBCOMMFAIL:
-				    case XAException.XA_RBDEADLOCK:
-				    case XAException.XA_RBINTEGRITY:
-				    case XAException.XA_RBOTHER:
-				    case XAException.XA_RBPROTO:
-				    case XAException.XA_RBTIMEOUT:
-				    case XAException.XA_RBTRANSIENT:
-					/*
-					 * Has been marked as rollback-only. We still
-					 * need to call rollback.
-					 */
+	                switch (e1.errorCode)
+	                {
+	                case XAException.XA_HEURHAZ:
+	                case XAException.XA_HEURMIX:
+	                case XAException.XA_HEURCOM:
+	                case XAException.XA_HEURRB:
+	                    endHeuristic = e1;
+	                    break;
+	                case XAException.XA_RBROLLBACK:
+	                case XAException.XA_RBCOMMFAIL:
+	                case XAException.XA_RBDEADLOCK:
+	                case XAException.XA_RBINTEGRITY:
+	                case XAException.XA_RBOTHER:
+	                case XAException.XA_RBPROTO:
+	                case XAException.XA_RBTIMEOUT:
+	                case XAException.XA_RBTRANSIENT:
+	                    /*
+	                     * Has been marked as rollback-only. We still
+	                     * need to call rollback.
+	                     */
 
-					commit = false;
-					break;
-				    case XAException.XAER_RMERR:
-				    case XAException.XAER_NOTA:
-				    case XAException.XAER_PROTO:
-				    case XAException.XAER_INVAL:
-				    case XAException.XAER_RMFAIL:
-				    default:
-				    {
-                        if (jtaLogger.loggerI18N.isWarnEnabled())
-                        {
-                            jtaLogger.loggerI18N.warn(
-                                    "com.arjuna.ats.internal.jta.resources.arjunacore.opcerror",
-                                    new Object[] { _tranID, _theXAResource, XAHelper.printXAErrorCode(e1) }, e1);
-                        }
+	                    commit = false;
+	                    break;
+	                case XAException.XAER_RMERR:
+	                case XAException.XAER_NOTA:
+	                case XAException.XAER_PROTO:
+	                case XAException.XAER_INVAL:
+	                case XAException.XAER_RMFAIL:
+	                default:
+	                {
+	                    if (jtaLogger.loggerI18N.isWarnEnabled())
+	                    {
+	                        jtaLogger.loggerI18N.warn(
+	                                "com.arjuna.ats.internal.jta.resources.arjunacore.opcerror",
+	                                new Object[] { _tranID, _theXAResource, XAHelper.printXAErrorCode(e1) }, e1);
+	                    }
 
 
-                        removeConnection();
-                        return TwoPhaseOutcome.FINISH_ERROR;
-				    }
-				    }
-				}
-                catch(RuntimeException e)
-                {
-                    if (jtaLogger.loggerI18N.isWarnEnabled())
-                    {
-                        jtaLogger.loggerI18N.warn(
-                                "com.arjuna.ats.internal.jta.resources.arjunacore.opcerror",
-                                new Object[] { _tranID, _theXAResource, e.toString() }, e);
-                    }
+	                    removeConnection();
+	                    return TwoPhaseOutcome.FINISH_ERROR;
+	                }
+	                }
+	            }
+	            catch(RuntimeException e)
+	            {
+	                if (jtaLogger.loggerI18N.isWarnEnabled())
+	                {
+	                    jtaLogger.loggerI18N.warn(
+	                            "com.arjuna.ats.internal.jta.resources.arjunacore.opcerror",
+	                            new Object[] { _tranID, _theXAResource, e.toString() }, e);
+	                }
 
-                    throw e;
-                }
+	                throw e;
+	            }
 
-				try
-				{
-				    /*
-				     * Not strictly necessary since calling commit will
-				     * do the rollback if end failed as above.
-				     */
+	            try
+	            {
+	                /*
+	                 * Not strictly necessary since calling commit will
+	                 * do the rollback if end failed as above.
+	                 */
 
-				    if (endHeuristic != null) // catch those RMs that terminate in end rather than follow the spec
-					throw endHeuristic;
+	                if (endHeuristic != null) // catch those RMs that terminate in end rather than follow the spec
+	                    throw endHeuristic;
 
-				    if (commit)
-					_theXAResource.commit(_tranID, true);
-				    else
-					_theXAResource.rollback(_tranID);
-				}
-				catch (XAException e1)
-				{
-                    if (jtaLogger.loggerI18N.isWarnEnabled())
-                    {
-                        jtaLogger.loggerI18N.warn(
-                                "com.arjuna.ats.internal.jta.resources.arjunacore.opcerror",
-                                new Object[] { _tranID, _theXAResource, XAHelper.printXAErrorCode(e1) }, e1);
-                    }
+	                if (commit)
+	                    _theXAResource.commit(_tranID, true);
+	                else
+	                    _theXAResource.rollback(_tranID);
+	            }
+	            catch (XAException e1)
+	            {
+	                if (jtaLogger.loggerI18N.isWarnEnabled())
+	                {
+	                    jtaLogger.loggerI18N.warn(
+	                            "com.arjuna.ats.internal.jta.resources.arjunacore.opcerror",
+	                            new Object[] { _tranID, _theXAResource, XAHelper.printXAErrorCode(e1) }, e1);
+	                }
 
-					/*
-					 * XA_HEURHAZ, XA_HEURCOM, XA_HEURRB, XA_HEURMIX,
-					 * XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or
-					 * XAER_PROTO. XA_RB*
-					 */
+	                /*
+	                 * XA_HEURHAZ, XA_HEURCOM, XA_HEURRB, XA_HEURMIX,
+	                 * XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or
+	                 * XAER_PROTO. XA_RB*
+	                 */
 
-					switch (e1.errorCode)
-					{
-					case XAException.XA_HEURHAZ:
-					case XAException.XA_HEURMIX:
-						return TwoPhaseOutcome.HEURISTIC_HAZARD;
-					case XAException.XA_HEURCOM:
-						forget();
-						break;
-					case XAException.XA_HEURRB:
-					case XAException.XA_RBROLLBACK:
-					case XAException.XA_RBCOMMFAIL:
-					case XAException.XA_RBDEADLOCK:
-					case XAException.XA_RBINTEGRITY:
-					case XAException.XA_RBOTHER:
-					case XAException.XA_RBPROTO:
-					case XAException.XA_RBTIMEOUT:
-					case XAException.XA_RBTRANSIENT:
-					case XAException.XAER_RMERR:
-						forget();
-						return TwoPhaseOutcome.HEURISTIC_ROLLBACK;
-					case XAException.XAER_NOTA:
-						return TwoPhaseOutcome.HEURISTIC_HAZARD; // something committed or rolled back without asking us!
-                                        case XAException.XAER_INVAL:
-                                        case XAException.XAER_RMFAIL: // resource manager
-                                                // failed, did it
-                                                // rollback?
-                                                return TwoPhaseOutcome.HEURISTIC_HAZARD;
-	                                case XAException.XA_RETRY:
-	                                case XAException.XAER_PROTO:
-					default:
-					    _committed = true;  // will cause log to be rewritten
-						return TwoPhaseOutcome.FINISH_ERROR;  // recovery should retry
-					}
-				}
-				catch (Exception e2)
-				{
-					if (jtaLogger.loggerI18N.isWarnEnabled())
-					{
-                        jtaLogger.loggerI18N.warn(
-                                "com.arjuna.ats.internal.jta.resources.arjunacore.opcerror",
-                                new Object[] { _tranID, _theXAResource, e2.toString() }, e2);
-					}
+	                switch (e1.errorCode)
+	                {
+	                case XAException.XA_HEURHAZ:
+	                case XAException.XA_HEURMIX:
+	                    return TwoPhaseOutcome.HEURISTIC_HAZARD;
+	                case XAException.XA_HEURCOM:
+	                    forget();
+	                    break;
+	                case XAException.XA_HEURRB:
+	                case XAException.XA_RBROLLBACK:
+	                case XAException.XA_RBCOMMFAIL:
+	                case XAException.XA_RBDEADLOCK:
+	                case XAException.XA_RBINTEGRITY:
+	                case XAException.XA_RBOTHER:
+	                case XAException.XA_RBPROTO:
+	                case XAException.XA_RBTIMEOUT:
+	                case XAException.XA_RBTRANSIENT:
+	                case XAException.XAER_RMERR:
+	                    forget();
+	                    return TwoPhaseOutcome.HEURISTIC_ROLLBACK;
+	                case XAException.XAER_NOTA:
+	                    return TwoPhaseOutcome.HEURISTIC_HAZARD; // something committed or rolled back without asking us!
+	                case XAException.XAER_INVAL:
+	                case XAException.XAER_RMFAIL: // resource manager
+	                    // failed, did it
+	                    // rollback?
+	                    return TwoPhaseOutcome.HEURISTIC_HAZARD;
+	                case XAException.XA_RETRY:
+	                case XAException.XAER_PROTO:
+	                default:
+	                    _committed = true;  // will cause log to be rewritten
+	                return TwoPhaseOutcome.FINISH_ERROR;  // recovery should retry
+	                }
+	            }
+	            catch (Exception e2)
+	            {
+	                if (jtaLogger.loggerI18N.isWarnEnabled())
+	                {
+	                    jtaLogger.loggerI18N.warn(
+	                            "com.arjuna.ats.internal.jta.resources.arjunacore.opcerror",
+	                            new Object[] { _tranID, _theXAResource, e2.toString() }, e2);
+	                }
 
-					return TwoPhaseOutcome.FINISH_ERROR;
-				}
-				finally
-				{
-					removeConnection();
-				}
-			}
-			else
-				return TwoPhaseOutcome.FINISH_ERROR;
-		}
+	                return TwoPhaseOutcome.FINISH_ERROR;
+	            }
+	            finally
+	            {
+	                removeConnection();
+	            }
+	        }
+	        else
+	            return TwoPhaseOutcome.ONE_PHASE_ERROR;
+	    }
 
-		return TwoPhaseOutcome.FINISH_OK;
+	    return TwoPhaseOutcome.FINISH_OK;
 	}
 
 	public boolean forgetHeuristic()

Modified: labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/resources/jts/orbspecific/XAResourceRecord.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/resources/jts/orbspecific/XAResourceRecord.java	2009-09-14 13:34:05 UTC (rev 29334)
+++ labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/resources/jts/orbspecific/XAResourceRecord.java	2009-09-14 14:29:09 UTC (rev 29335)
@@ -739,182 +739,186 @@
 	public void commit_one_phase() throws HeuristicHazard,
 			org.omg.CORBA.SystemException
 	{
-		if (jtaLogger.logger.isDebugEnabled())
-		{
-			jtaLogger.logger.debug(DebugLevel.FUNCTIONS,
-					VisibilityLevel.VIS_PUBLIC,
-					com.arjuna.ats.jta.logging.FacilityCode.FAC_JTA,
-					"XAResourceRecord.commit_one_phase for " + _tranID);
-		}
+	    if (jtaLogger.logger.isDebugEnabled())
+	    {
+	        jtaLogger.logger.debug(DebugLevel.FUNCTIONS,
+	                VisibilityLevel.VIS_PUBLIC,
+	                com.arjuna.ats.jta.logging.FacilityCode.FAC_JTA,
+	                "XAResourceRecord.commit_one_phase for " + _tranID);
+	    }
 
-		if (_tranID == null)
-		{
-			if (jtaLogger.loggerI18N.isWarnEnabled())
-			{
-				jtaLogger.loggerI18N
-						.warn(
-								"com.arjuna.ats.internal.jta.resources.jts.orbspecific.nulltransaction",
-								new Object[]
-								{ "XAResourceRecord.commit_one_phase" });
-			}
-		}
-		else
-		{
-			if (_theXAResource != null)
-			{
-				try
-				{
-					switch (_heuristic)
-					{
-					case TwoPhaseOutcome.HEURISTIC_HAZARD:
-						throw new org.omg.CosTransactions.HeuristicHazard();
-					default:
-						break;
-					}
+	    if (_tranID == null)
+	    {
+	        if (jtaLogger.loggerI18N.isWarnEnabled())
+	        {
+	            jtaLogger.loggerI18N
+	            .warn(
+	                    "com.arjuna.ats.internal.jta.resources.jts.orbspecific.nulltransaction",
+	                    new Object[]
+	                               { "XAResourceRecord.commit_one_phase" });
+	        }
 
-					/*
-					 * TODO in Oracle, the end is not required. Is this
-					 * common to other RM implementations?
-					 */
+	        throw new TRANSACTION_ROLLEDBACK();
+	    }
+	    else
+	    {
+	        if (_theXAResource != null)
+	        {
+	            try
+	            {
+	                switch (_heuristic)
+	                {
+	                case TwoPhaseOutcome.HEURISTIC_HAZARD:
+	                    throw new org.omg.CosTransactions.HeuristicHazard();
+	                default:
+	                    break;
+	                }
 
-					boolean commit = true;
+	                /*
+	                 * TODO in Oracle, the end is not required. Is this
+	                 * common to other RM implementations?
+	                 */
 
-					try
-					{
-        					if (endAssociation())
-        					{
-        						_theXAResource.end(_tranID, XAResource.TMSUCCESS);
-        					}
-					}
-					catch (XAException e1)
-					{
-					    /*
-					     * Now it's not legal to return a heuristic from end, but
-					     * apparently Oracle does (http://jira.jboss.com/jira/browse/JBTM-343)
-					     * Since this is 1PC we can call forget: the outcome of the
-					     * transaction is the outcome of the participant.
-					     */
+	                boolean commit = true;
 
-					    switch (e1.errorCode)
-					    {
-					    case XAException.XA_HEURHAZ:
-					    case XAException.XA_HEURMIX:
-					    case XAException.XA_HEURCOM:
-					    case XAException.XA_HEURRB:
-						throw e1;
-					    case XAException.XA_RBROLLBACK:
-					    case XAException.XA_RBCOMMFAIL:
-					    case XAException.XA_RBDEADLOCK:
-					    case XAException.XA_RBINTEGRITY:
-					    case XAException.XA_RBOTHER:
-					    case XAException.XA_RBPROTO:
-					    case XAException.XA_RBTIMEOUT:
-					    case XAException.XA_RBTRANSIENT:
-						/*
-						 * Has been marked as rollback-only. We still
-						 * need to call rollback.
-						 */
+	                try
+	                {
+	                    if (endAssociation())
+	                    {
+	                        _theXAResource.end(_tranID, XAResource.TMSUCCESS);
+	                    }
+	                }
+	                catch (XAException e1)
+	                {
+	                    /*
+	                     * Now it's not legal to return a heuristic from end, but
+	                     * apparently Oracle does (http://jira.jboss.com/jira/browse/JBTM-343)
+	                     * Since this is 1PC we can call forget: the outcome of the
+	                     * transaction is the outcome of the participant.
+	                     */
 
-						commit = false;
-						break;
-					    case XAException.XAER_RMERR:
-					    case XAException.XAER_NOTA:
-					    case XAException.XAER_PROTO:
-					    case XAException.XAER_INVAL:
-					    case XAException.XAER_RMFAIL:
-					    default:
-					    {
-						throw new UNKNOWN();
-					    }
-					    }
-					}
+	                    switch (e1.errorCode)
+	                    {
+	                    case XAException.XA_HEURHAZ:
+	                    case XAException.XA_HEURMIX:
+	                    case XAException.XA_HEURCOM:
+	                    case XAException.XA_HEURRB:
+	                        throw e1;
+	                    case XAException.XA_RBROLLBACK:
+	                    case XAException.XA_RBCOMMFAIL:
+	                    case XAException.XA_RBDEADLOCK:
+	                    case XAException.XA_RBINTEGRITY:
+	                    case XAException.XA_RBOTHER:
+	                    case XAException.XA_RBPROTO:
+	                    case XAException.XA_RBTIMEOUT:
+	                    case XAException.XA_RBTRANSIENT:
+	                        /*
+	                         * Has been marked as rollback-only. We still
+	                         * need to call rollback.
+	                         */
 
-					_theXAResource.commit(_tranID, true);
-				}
-				catch (XAException e1)
-				{
-					/*
-					 * XA_HEURHAZ, XA_HEURCOM, XA_HEURRB, XA_HEURMIX,
-					 * XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or
-					 * XAER_PROTO. XA_RB*
-					 */
+	                        commit = false;
+	                        break;
+	                    case XAException.XAER_RMERR:
+	                    case XAException.XAER_NOTA:
+	                    case XAException.XAER_PROTO:
+	                    case XAException.XAER_INVAL:
+	                    case XAException.XAER_RMFAIL:
+	                    default:
+	                    {
+	                        throw new UNKNOWN();
+	                    }
+	                    }
+	                }
 
-					if ((e1.errorCode >= XAException.XA_RBBASE)
-							&& (e1.errorCode <= XAException.XA_RBEND))
-					{
-						throw new TRANSACTION_ROLLEDBACK();
-					}
+	                _theXAResource.commit(_tranID, true);
+	            }
+	            catch (XAException e1)
+	            {
+	                /*
+	                 * XA_HEURHAZ, XA_HEURCOM, XA_HEURRB, XA_HEURMIX,
+	                 * XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or
+	                 * XAER_PROTO. XA_RB*
+	                 */
 
-					switch (e1.errorCode)
-					{
-					case XAException.XA_HEURHAZ:
-					case XAException.XA_HEURMIX:
-						updateState(TwoPhaseOutcome.HEURISTIC_HAZARD);
+	                if ((e1.errorCode >= XAException.XA_RBBASE)
+	                        && (e1.errorCode <= XAException.XA_RBEND))
+	                {
+	                    throw new TRANSACTION_ROLLEDBACK();
+	                }
 
-						throw new org.omg.CosTransactions.HeuristicHazard();
-					case XAException.XA_HEURCOM:
-						handleForget() ;
-						break;
-					case XAException.XA_HEURRB:
-					case XAException.XA_RBROLLBACK:
-					case XAException.XA_RBCOMMFAIL:
-					case XAException.XA_RBDEADLOCK:
-					case XAException.XA_RBINTEGRITY:
-					case XAException.XA_RBOTHER:
-					case XAException.XA_RBPROTO:
-					case XAException.XA_RBTIMEOUT:
-					case XAException.XA_RBTRANSIENT:
-					case XAException.XAER_RMERR:
-						handleForget() ;
-						throw new TRANSACTION_ROLLEDBACK();
+	                switch (e1.errorCode)
+	                {
+	                case XAException.XA_HEURHAZ:
+	                case XAException.XA_HEURMIX:
+	                    updateState(TwoPhaseOutcome.HEURISTIC_HAZARD);
 
-					case XAException.XAER_NOTA:
-                        // RM unexpectedly lost track of the tx, outcome is uncertain
-                        updateState(TwoPhaseOutcome.HEURISTIC_HAZARD);
-						throw new org.omg.CosTransactions.HeuristicHazard();
-					case XAException.XAER_PROTO:
-                        // presumed abort (or we could be really paranoid and throw a heuristic)
-                        throw new TRANSACTION_ROLLEDBACK();
+	                    throw new org.omg.CosTransactions.HeuristicHazard();
+	                case XAException.XA_HEURCOM:
+	                    handleForget() ;
+	                    break;
+	                case XAException.XA_HEURRB:
+	                case XAException.XA_RBROLLBACK:
+	                case XAException.XA_RBCOMMFAIL:
+	                case XAException.XA_RBDEADLOCK:
+	                case XAException.XA_RBINTEGRITY:
+	                case XAException.XA_RBOTHER:
+	                case XAException.XA_RBPROTO:
+	                case XAException.XA_RBTIMEOUT:
+	                case XAException.XA_RBTRANSIENT:
+	                case XAException.XAER_RMERR:
+	                    handleForget() ;
+	                    throw new TRANSACTION_ROLLEDBACK();
 
-					case XAException.XAER_INVAL:
-					case XAException.XAER_RMFAIL: // resource manager failed,
-												  // did it rollback?
-						throw new org.omg.CosTransactions.HeuristicHazard();
-					case XAException.XA_RETRY:
-					default:
-					    _committed = true;  // will cause log to be rewritten
-					
-						throw new UNKNOWN();
-					}
-				}
-				catch (SystemException ex)
-				{
-					ex.printStackTrace();
+	                case XAException.XAER_NOTA:
+	                    // RM unexpectedly lost track of the tx, outcome is uncertain
+	                    updateState(TwoPhaseOutcome.HEURISTIC_HAZARD);
+	                    throw new org.omg.CosTransactions.HeuristicHazard();
+	                case XAException.XAER_PROTO:
+	                    // presumed abort (or we could be really paranoid and throw a heuristic)
+	                    throw new TRANSACTION_ROLLEDBACK();
 
-					throw ex;
-				}
-				catch (org.omg.CosTransactions.HeuristicHazard ex)
-				{
-					throw ex;
-				}
-				catch (Exception e2)
-				{
-					if (jtaLogger.loggerI18N.isWarnEnabled())
-					{
-						jtaLogger.loggerI18N
-								.warn(
-										"com.arjuna.ats.internal.jta.resources.jts.orbspecific.coperror",
-										new Object[] {e2}, e2);
-					}
+	                case XAException.XAER_INVAL:
+	                case XAException.XAER_RMFAIL: // resource manager failed,
+	                    // did it rollback?
+	                    throw new org.omg.CosTransactions.HeuristicHazard();
+	                case XAException.XA_RETRY:
+	                default:
+	                    _committed = true;  // will cause log to be rewritten
 
-					throw new UNKNOWN();
-				}
-				finally
-				{
-					removeConnection();
-				}
-			}
-		}
+	                throw new UNKNOWN();
+	                }
+	            }
+	            catch (SystemException ex)
+	            {
+	                ex.printStackTrace();
+
+	                throw ex;
+	            }
+	            catch (org.omg.CosTransactions.HeuristicHazard ex)
+	            {
+	                throw ex;
+	            }
+	            catch (Exception e2)
+	            {
+	                if (jtaLogger.loggerI18N.isWarnEnabled())
+	                {
+	                    jtaLogger.loggerI18N
+	                    .warn(
+	                            "com.arjuna.ats.internal.jta.resources.jts.orbspecific.coperror",
+	                            new Object[] {e2}, e2);
+	                }
+
+	                throw new UNKNOWN();
+	            }
+	            finally
+	            {
+	                removeConnection();
+	            }
+	        }
+	        else
+	            throw new TRANSACTION_ROLLEDBACK();
+	    }
 	}
 
 	public void forget() throws org.omg.CORBA.SystemException

Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/resources/ExtendedResourceRecord.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/resources/ExtendedResourceRecord.java	2009-09-14 13:34:05 UTC (rev 29334)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/resources/ExtendedResourceRecord.java	2009-09-14 14:29:09 UTC (rev 29335)
@@ -645,11 +645,11 @@
 		     * to communicate that back to the caller.
 		     */
 		    
-			return TwoPhaseOutcome.HEURISTIC_ROLLBACK;  // TODO TPO extension required.
+			return TwoPhaseOutcome.ONE_PHASE_ERROR;  // TODO TPO extension required.
 		}
 		catch (INVALID_TRANSACTION e5)
 		{
-			return TwoPhaseOutcome.FINISH_ERROR;
+			return TwoPhaseOutcome.ONE_PHASE_ERROR;
 		}
 		catch (final UNKNOWN ex)
 		{

Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/resources/ResourceRecord.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/resources/ResourceRecord.java	2009-09-14 13:34:05 UTC (rev 29334)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/resources/ResourceRecord.java	2009-09-14 14:29:09 UTC (rev 29335)
@@ -583,11 +583,11 @@
 	}
 	catch (TRANSACTION_ROLLEDBACK e4)
 	{
-	    return TwoPhaseOutcome.FINISH_ERROR;
+	    return TwoPhaseOutcome.ONE_PHASE_ERROR;
 	}
 	catch (INVALID_TRANSACTION e5)
 	{
-	    return TwoPhaseOutcome.FINISH_ERROR;
+	    return TwoPhaseOutcome.ONE_PHASE_ERROR;
 	}
 	catch (Exception e5)
 	{



More information about the jboss-svn-commits mailing list