[jboss-svn-commits] JBL Code SVN: r23858 - labs/jbosstm/branches/JBOSSTS_4_2_3_GA_SP/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/subordinate.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Nov 13 09:43:23 EST 2008


Author: jhalliday
Date: 2008-11-13 09:43:23 -0500 (Thu, 13 Nov 2008)
New Revision: 23858

Modified:
   labs/jbosstm/branches/JBOSSTS_4_2_3_GA_SP/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/subordinate/SubordinateAtomicAction.java
Log:
Merged JBTM-425 from trunk to 4.2.3.SP
-- This line, and those below, will be ignored--

M    ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/subordinate/SubordinateAtomicAction.java


Modified: labs/jbosstm/branches/JBOSSTS_4_2_3_GA_SP/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/subordinate/SubordinateAtomicAction.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_2_3_GA_SP/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/subordinate/SubordinateAtomicAction.java	2008-11-13 14:37:43 UTC (rev 23857)
+++ labs/jbosstm/branches/JBOSSTS_4_2_3_GA_SP/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/subordinate/SubordinateAtomicAction.java	2008-11-13 14:43:23 UTC (rev 23858)
@@ -1,28 +1,28 @@
 /*
  * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors 
- * as indicated by the @author tags. 
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
  * See the copyright.txt in the distribution for a
- * full listing of individual contributors. 
+ * full listing of individual contributors.
  * This copyrighted material is made available to anyone wishing to use,
  * modify, copy, or redistribute it subject to the terms and conditions
  * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A 
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
  * You should have received a copy of the GNU Lesser General Public License,
  * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
- * 
+ *
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
 /*
  * Copyright (C) 2003,
- * 
+ *
  * Hewlett-Packard Arjuna Labs, Newcastle upon Tyne, Tyne and Wear, UK.
- * 
+ *
  * $Id: SubordinateAtomicAction.java 2342 2006-03-30 13:06:17Z  $
  */
 
@@ -37,7 +37,7 @@
 /**
  * A subordinate JTA transaction; used when importing another transaction
  * context.
- * 
+ *
  * @author mcl
  */
 
@@ -48,18 +48,18 @@
 	public SubordinateAtomicAction ()
 	{
 		super();
-		
+
 		start();
 	}
 
 	public SubordinateAtomicAction (int timeout)
 	{
 		super();
-		
+
 		start();
-		
+
 		// if it has a non-negative timeout, add it to the reaper.
-		
+
 		if (timeout > AtomicAction.NO_TIMEOUT)
 			TransactionReaper.transactionReaper(true).insert(this, timeout);
 	}
@@ -67,7 +67,7 @@
 	/**
 	 * Commit the transaction, and have heuristic reporting. Heuristic reporting
 	 * via the return code is enabled.
-	 * 
+	 *
 	 * @return <code>ActionStatus</code> indicating outcome.
 	 */
 
@@ -79,10 +79,10 @@
 	/**
 	 * Commit the transaction. The report_heuristics parameter can be used to
 	 * determine whether or not heuristic outcomes are reported.
-	 * 
+	 *
 	 * If the transaction has already terminated, or has not begun, then an
 	 * appropriate error code will be returned.
-	 * 
+	 *
 	 * @return <code>ActionStatus</code> indicating outcome.
 	 */
 
@@ -93,10 +93,10 @@
 
 	/**
 	 * Abort (rollback) the transaction.
-	 * 
+	 *
 	 * If the transaction has already terminated, or has not been begun, then an
 	 * appropriate error code will be returned.
-	 * 
+	 *
 	 * @return <code>ActionStatus</code> indicating outcome.
 	 */
 
@@ -108,15 +108,15 @@
 	/**
 	 * The type of the class is used to locate the state of the transaction log
 	 * in the object store.
-	 * 
+	 *
 	 * Overloads BasicAction.type()
-	 * 
+	 *
 	 * @return a string representation of the hierarchy of the class for storing
 	 *         logs in the transaction object store.
 	 */
 
 	// TODO crash recovery!!!!
-	
+
 	public String type ()
 	{
 		return "/StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction/SubordinateAtomicAction";
@@ -124,12 +124,20 @@
 
 	public int doPrepare ()
 	{
-		if (super.beforeCompletion())
-			return super.prepare(true);
+		if (super.beforeCompletion()) {
+            int outcome = super.prepare(true);
+            if(outcome == TwoPhaseOutcome.PREPARE_READONLY) {
+                // we won't get called again, so we need to clean up
+                // and run the afterCompletions before returning.
+                doCommit();
+            }
+
+            return outcome;
+        }
 		else
 		{
 			super.phase2Abort(true);
-			
+
 			return TwoPhaseOutcome.PREPARE_NOTOK;
 		}
 	}
@@ -139,12 +147,12 @@
 		super.phase2Commit(true);
 
 		int toReturn;
-		
+
 		switch (super.getHeuristicDecision())
 		{
 		case TwoPhaseOutcome.PREPARE_OK:
 		case TwoPhaseOutcome.FINISH_OK:
-			toReturn = super.status();		
+			toReturn = super.status();
 			break;
 		case TwoPhaseOutcome.HEURISTIC_ROLLBACK:
 			toReturn = ActionStatus.H_ROLLBACK;
@@ -160,18 +168,18 @@
 			toReturn = ActionStatus.H_HAZARD;
 			break;
 		}
-		
+
 		super.afterCompletion(toReturn);
-		
+
 		return toReturn;
 	}
 
 	public int doRollback ()
 	{
 		super.phase2Abort(true);
-		
+
 		int toReturn;
-		
+
 		switch (super.getHeuristicDecision())
 		{
 		case TwoPhaseOutcome.PREPARE_OK:
@@ -192,25 +200,25 @@
 			toReturn = ActionStatus.H_HAZARD;
 			break;
 		}
-		
+
 		super.afterCompletion(toReturn);
-		
+
 		return toReturn;
 	}
 
 	public int doOnePhaseCommit ()
 	{
 	    int status;
-	    
+
 	    if (beforeCompletion())
 	    {
 		status = super.End(true);
 	    }
 	    else
 	        status = ActionStatus.ABORTED;
-	              
+
             afterCompletion(status);
-            
+
             return status;
 	}
 
@@ -218,23 +226,23 @@
 	{
 		super.forgetHeuristics();
 	}
-	
+
 	/**
 	 * For crash recovery purposes.
-	 * 
+	 *
 	 * @param actId the identifier to recover.
 	 */
-	
+
 	protected SubordinateAtomicAction (Uid actId)
 	{
 		super(actId);
 	}
-	
+
 	/**
 	 * By default the BasicAction class only allows the termination of a
 	 * transaction if it's the one currently associated with the thread. We
 	 * override this here.
-	 * 
+	 *
 	 * @return <code>false</code> to indicate that this transaction can only
 	 *         be terminated by the right thread.
 	 */
@@ -243,5 +251,9 @@
 	{
 		return false;
 	}
-	
+
+    public boolean activated ()
+    {
+    	return true;
+    }
 }




More information about the jboss-svn-commits mailing list