[jboss-svn-commits] JBL Code SVN: r23853 - 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
Thu Nov 13 09:04:00 EST 2008
Author: jhalliday
Date: 2008-11-13 09:04:00 -0500 (Thu, 13 Nov 2008)
New Revision: 23853
Modified:
labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/subordinate/SubordinateAtomicAction.java
Log:
Don't run beforeCompletion for subordinate tx we know are going to rollback. JBTM-429
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-13 11:29:30 UTC (rev 23852)
+++ labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/subordinate/SubordinateAtomicAction.java 2008-11-13 14:04:00 UTC (rev 23853)
@@ -122,14 +122,22 @@
public int doPrepare ()
{
- if (super.beforeCompletion()) {
+ int status = super.status();
+
+ // In JTA spec, beforeCompletions are run on commit attempts only, not rollbacks.
+ // We attempt to mimic that here, even though we are outside the scope of the spec.
+ // note it's not perfect- async timeout/rollback means there is a race condition in which we
+ // can still call beforeCompletion on rollbacks, but that's not too bad as skipping it is really
+ // just an optimization anyhow. JBTM-429
+ if ( !(status == ActionStatus.ABORT_ONLY || status == ActionStatus.ABORTING) && 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
@@ -205,21 +213,28 @@
}
public int doOnePhaseCommit ()
- {
- int status;
+ {
+ int status = super.status();
- if (beforeCompletion())
- {
- status = super.End(true);
- }
- else
- status = ActionStatus.ABORTED;
+ // In JTA spec, beforeCompletions are run on commit attempts only, not rollbacks.
+ // We attempt to mimic that here, even though we are outside the scope of the spec.
+ // note it's not perfect- async timeout/rollback means there is a race condition in which we
+ // can still call beforeCompletion on rollbacks, but that's not too bad as skipping it is really
+ // just an optimization anyhow. JBTM-429
+ // behaviour relies on java's lazy evaluation of the if clause:
+ if (status == ActionStatus.ABORT_ONLY || super.beforeCompletion())
+ {
+ status = super.End(true);
+ }
+ else
+ {
+ status = ActionStatus.ABORTED;
+ }
- afterCompletion(status);
+ afterCompletion(status);
+ return status;
+ }
- return status;
- }
-
public void doForget ()
{
super.forgetHeuristics();
More information about the jboss-svn-commits
mailing list