[jboss-svn-commits] JBL Code SVN: r29499 - in labs/jbosstm/trunk: ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/subordinate and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Sep 29 05:27:36 EDT 2009


Author: mark.little at jboss.com
Date: 2009-09-29 05:27:35 -0400 (Tue, 29 Sep 2009)
New Revision: 29499

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/transaction/arjunacore/subordinate/TransactionImple.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-29 09:18:42 UTC (rev 29498)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/BasicAction.java	2009-09-29 09:27:35 UTC (rev 29499)
@@ -2723,7 +2723,9 @@
 			{
 			    /*
 			     * If ONE_PHASE_ERROR then the resource has rolled back. Otherwise we
-			     * don't know and will ask recovery to keep trying.
+			     * don't know and will ask recovery to keep trying. We differentiate
+			     * this kind of failure from a heuristic failure so that we can allow
+			     * recovery to retry the commit attempt periodically.
 			     */
 			    
 			    if (p == TwoPhaseOutcome.FINISH_ERROR)
@@ -2740,6 +2742,14 @@
                                         if (!stateToSave)
                                             stateToSave = recordBeingHandled.doSave();
                                     }
+        			    
+        			    /*
+        			     * There's been a problem and we need to retry later. Assume
+        			     * transaction has committed until we have further information.
+        			     * This also ensures that recovery will kick in periodically.
+        			     */
+        			    
+        			    actionStatus = ActionStatus.COMMITTED;
 			    }
 			    else			    
 			        actionStatus = ActionStatus.ABORTED;

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-29 09:18:42 UTC (rev 29498)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TwoPhaseOutcome.java	2009-09-29 09:27:35 UTC (rev 29499)
@@ -53,18 +53,18 @@
 public class TwoPhaseOutcome
 {
 
-    public static final int PREPARE_OK = 0;
-    public static final int PREPARE_NOTOK = 1;
-    public static final int PREPARE_READONLY = 2;
-    public static final int HEURISTIC_ROLLBACK = 3;
-    public static final int HEURISTIC_COMMIT = 4;
-    public static final int HEURISTIC_MIXED = 5;
-    public static final int HEURISTIC_HAZARD = 6;
-    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 PREPARE_OK = 0;  // prepared OK
+    public static final int PREPARE_NOTOK = 1; // did not prepare so force roll back
+    public static final int PREPARE_READONLY = 2; // only used to read the state, so no need for second phase
+    public static final int HEURISTIC_ROLLBACK = 3; // after prepare decided to roll back without waiting for coordinator
+    public static final int HEURISTIC_COMMIT = 4;  // after prepare decided to commit without waiting for coordinator
+    public static final int HEURISTIC_MIXED = 5;  // after prepare some sub-participants committed and some rolled back without waiting for coordinator
+    public static final int HEURISTIC_HAZARD = 6;  // after prepare some sub-participants committed, some rolled back and some we don't know
+    public static final int FINISH_OK = 7;  // the second phase completed ok
+    public static final int FINISH_ERROR = 8;  // there was a failure during the second phase and we should retry later (not necessarily a heuristic)
+    public static final int NOT_PREPARED = 9;  // participant told to do second phase operation when it hadn't seen the first phase
     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 static final int INVALID_TRANSACTION = 11;  // invalid!
 
     public TwoPhaseOutcome (int outcome)
     {

Modified: labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/subordinate/TransactionImple.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/subordinate/TransactionImple.java	2009-09-29 09:18:42 UTC (rev 29498)
+++ labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/subordinate/TransactionImple.java	2009-09-29 09:27:35 UTC (rev 29499)
@@ -287,18 +287,17 @@
 				break;
 			case ActionStatus.ABORTED:
 	                 case ActionStatus.ABORTING:
+	                 case ActionStatus.H_ROLLBACK:
                 TransactionImple.removeTransaction(this);
                 // JBTM-428. Note also this may be because the tx was set rollback only,
                 // in which case IllegalState may be a better option?
                 throw new RollbackException();
-
+	                case ActionStatus.INVALID:
+	                                throw new InvalidTerminationStateException();
 			case ActionStatus.H_HAZARD:
 			case ActionStatus.H_MIXED:
-			case ActionStatus.H_ROLLBACK:
 			default:
 				throw new javax.transaction.HeuristicMixedException();
-			case ActionStatus.INVALID:
-				throw new InvalidTerminationStateException();
 			}
 		}
 		catch (ClassCastException ex)



More information about the jboss-svn-commits mailing list