[jboss-svn-commits] JBL Code SVN: r23819 - labs/jbosstm/trunk/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
Tue Nov 11 06:20:35 EST 2008
Author: jhalliday
Date: 2008-11-11 06:20:34 -0500 (Tue, 11 Nov 2008)
New Revision: 23819
Modified:
labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/subordinate/SubordinateAtomicAction.java
Log:
Fix for correct synchronization handling during jta subordinate transaction termination. JBTM-425
Modified: labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/subordinate/SubordinateAtomicAction.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/subordinate/SubordinateAtomicAction.java 2008-11-11 07:01:15 UTC (rev 23818)
+++ labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/subordinate/SubordinateAtomicAction.java 2008-11-11 11:20:34 UTC (rev 23819)
@@ -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,9 +108,9 @@
/**
* 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.
*/
@@ -122,12 +122,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;
}
}
@@ -137,12 +145,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;
@@ -158,18 +166,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:
@@ -190,25 +198,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;
}
@@ -216,23 +224,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.
*/
@@ -245,5 +253,5 @@
public boolean activated ()
{
return true;
- }
+ }
}
More information about the jboss-svn-commits
mailing list