[jboss-svn-commits] JBL Code SVN: r37766 - in labs/jbosstm/branches/JBOSSTS_4_6_1_GA_CP04_JBTM-770: ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/resources/jts and 2 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Dec 2 10:06:40 EST 2011
Author: jbertram at redhat.com
Date: 2011-12-02 10:06:40 -0500 (Fri, 02 Dec 2011)
New Revision: 37766
Modified:
labs/jbosstm/branches/JBOSSTS_4_6_1_GA_CP04_JBTM-770/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TwoPhaseCoordinator.java
labs/jbosstm/branches/JBOSSTS_4_6_1_GA_CP04_JBTM-770/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/resources/jts/CleanupSynchronization.java
labs/jbosstm/branches/JBOSSTS_4_6_1_GA_CP04_JBTM-770/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/TransactionImple.java
labs/jbosstm/branches/JBOSSTS_4_6_1_GA_CP04_JBTM-770/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/coordinator/ArjunaTransactionImple.java
Log:
JBPAPP-7607
Modified: labs/jbosstm/branches/JBOSSTS_4_6_1_GA_CP04_JBTM-770/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TwoPhaseCoordinator.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_6_1_GA_CP04_JBTM-770/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TwoPhaseCoordinator.java 2011-12-02 14:25:33 UTC (rev 37765)
+++ labs/jbosstm/branches/JBOSSTS_4_6_1_GA_CP04_JBTM-770/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/coordinator/TwoPhaseCoordinator.java 2011-12-02 15:06:40 UTC (rev 37766)
@@ -212,8 +212,11 @@
* @message com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator_2
* [com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator_2]
* TwoPhaseCoordinator.beforeCompletion - failed for {0}
- */
-
+ *
+ * Drive beforeCompletion participants.
+ *
+ * @return true if successful, false otherwise.
+ */
protected boolean beforeCompletion ()
{
boolean problem = false;
@@ -238,7 +241,7 @@
* and we will rollback. Hence we don't then bother to call beforeCompletion
* on the remaining records (it's not done for rollabcks anyhow).
*
- * Since Synchronizations may add register other Synchronizations, we can't simply
+ * Since Synchronizations may register other Synchronizations, we can't simply
* iterate the collection. Instead we work from an ordered copy, which we periodically
* check for freshness. The addSynchronization method uses _currentRecord to disallow
* adding records in the part of the array we have already traversed, thus all
@@ -337,8 +340,13 @@
* @message com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator_4b
* [com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator_4b]
* TwoPhaseCoordinator.afterCompletion - failed for {0} with error {1}
- */
-
+ *
+ * Drive afterCompletion participants.
+ *
+ * @param myStatus the outcome of the transaction (ActionStatus.COMMITTED or ActionStatus.ABORTED).
+ *
+ * @return true if successful, false otherwise.
+ */
protected boolean afterCompletion (int myStatus)
{
if (myStatus == ActionStatus.RUNNING)
Modified: labs/jbosstm/branches/JBOSSTS_4_6_1_GA_CP04_JBTM-770/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/resources/jts/CleanupSynchronization.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_6_1_GA_CP04_JBTM-770/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/resources/jts/CleanupSynchronization.java 2011-12-02 14:25:33 UTC (rev 37765)
+++ labs/jbosstm/branches/JBOSSTS_4_6_1_GA_CP04_JBTM-770/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/resources/jts/CleanupSynchronization.java 2011-12-02 15:06:40 UTC (rev 37766)
@@ -33,10 +33,6 @@
import com.arjuna.ats.internal.jta.transaction.jts.TransactionImple;
-import com.arjuna.ats.jta.utils.JTAHelper;
-
-import javax.transaction.xa.*;
-
/**
* This synchronization is responsible for removing the JTA transaction
* from the internal table. We don't need one for the purely local JTA
Modified: labs/jbosstm/branches/JBOSSTS_4_6_1_GA_CP04_JBTM-770/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/TransactionImple.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_6_1_GA_CP04_JBTM-770/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/TransactionImple.java 2011-12-02 14:25:33 UTC (rev 37765)
+++ labs/jbosstm/branches/JBOSSTS_4_6_1_GA_CP04_JBTM-770/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/TransactionImple.java 2011-12-02 15:06:40 UTC (rev 37766)
@@ -61,6 +61,7 @@
import com.arjuna.ats.internal.jts.OTSImpleManager;
import com.arjuna.ats.internal.jts.ControlWrapper;
+import com.arjuna.ats.internal.jts.orbspecific.coordinator.ArjunaTransactionImple;
import com.arjuna.common.util.logging.*;
Modified: labs/jbosstm/branches/JBOSSTS_4_6_1_GA_CP04_JBTM-770/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/coordinator/ArjunaTransactionImple.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_6_1_GA_CP04_JBTM-770/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/coordinator/ArjunaTransactionImple.java 2011-12-02 14:25:33 UTC (rev 37765)
+++ labs/jbosstm/branches/JBOSSTS_4_6_1_GA_CP04_JBTM-770/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/coordinator/ArjunaTransactionImple.java 2011-12-02 15:06:40 UTC (rev 37766)
@@ -1446,76 +1446,76 @@
+ get_uid());
}
- boolean problem = false;
- SystemException exp = null;
+ boolean problem = false;
+ SystemException exp = null;
- /*
- * If we have a synchronization list then we must be top-level.
- */
- if (_synchs != null)
- {
- boolean doSuspend = false;
- ControlWrapper cw = null;
+ /*
+ * If we have a synchronization list then we must be top-level.
+ */
+ if (_synchs != null)
+ {
+ boolean doSuspend = false;
+ ControlWrapper cw = null;
- try
- {
- /*
- * Make sure that this transaction is active on the thread
- * before we invoke any Synchronizations. They are
- * TransactionalObjects and must have the context flowed to
- * them.
- */
+ try
+ {
+ /*
+ * Make sure that this transaction is active on the thread
+ * before we invoke any Synchronizations. They are
+ * TransactionalObjects and must have the context flowed to
+ * them.
+ */
- try
- {
- // cw = OTSImpleManager.systemCurrent().getControlWrapper();
+ try
+ {
+ // cw = OTSImpleManager.systemCurrent().getControlWrapper();
- cw = OTSImpleManager.current().getControlWrapper();
+ cw = OTSImpleManager.current().getControlWrapper();
- /*
- * If there's no transaction incoming, then use the one that
- * we got at creation time.
- */
+ /*
+ * If there's no transaction incoming, then use the one that
+ * we got at creation time.
+ */
- if ((cw == null) || (!controlHandle.equals(cw.getImple())))
- {
- // OTSImpleManager.systemCurrent().resumeImple(controlHandle);
+ if ((cw == null) || (!controlHandle.equals(cw.getImple())))
+ {
+ // OTSImpleManager.systemCurrent().resumeImple(controlHandle);
- OTSImpleManager.current().resumeImple(controlHandle);
+ OTSImpleManager.current().resumeImple(controlHandle);
- doSuspend = true;
- }
- }
- catch (Exception ex)
- {
- /*
- * It should be OK to continue with the invocations even if
- * we couldn't resume, because a Synchronization is only
- * supposed to be associated with a single transaction. So,
- * it should be able to infer the transaction.
- */
- }
+ doSuspend = true;
+ }
+ }
+ catch (Exception ex)
+ {
+ /*
+ * It should be OK to continue with the invocations even if
+ * we couldn't resume, because a Synchronization is only
+ * supposed to be associated with a single transaction. So,
+ * it should be able to infer the transaction.
+ */
+ }
- /*
- * Since Synchronizations may add register other Synchronizations, we can't simply
- * iterate the collection. Instead we work from an ordered copy, which we periodically
- * check for freshness. The addSynchronization method uses _currentRecord to disallow
- * adding records in the part of the array we have already traversed, thus all
- * Synchronization will be called and the (jta only) rules on ordering of interposed
- * Synchronization will be respected.
- */
- int lastIndexProcessed = -1;
- SynchronizationRecord[] copiedSynchs = (SynchronizationRecord[])_synchs.toArray(new SynchronizationRecord[] {});
+ /*
+ * Since Synchronizations may add register other Synchronizations, we can't simply
+ * iterate the collection. Instead we work from an ordered copy, which we periodically
+ * check for freshness. The addSynchronization method uses _currentRecord to disallow
+ * adding records in the part of the array we have already traversed, thus all
+ * Synchronization will be called and the (jta only) rules on ordering of interposed
+ * Synchronization will be respected.
+ */
+ int lastIndexProcessed = -1;
+ SynchronizationRecord[] copiedSynchs = (SynchronizationRecord[])_synchs.toArray(new SynchronizationRecord[] {});
- while( (lastIndexProcessed < _synchs.size()-1) && !problem) {
+ while( (lastIndexProcessed < _synchs.size()-1) && !problem) {
- // if new Synchronization have been registered, refresh our copy of the collection:
- if(copiedSynchs.length != _synchs.size()) {
- copiedSynchs = (SynchronizationRecord[])_synchs.toArray(new SynchronizationRecord[] {});
- }
+ // if new Synchronization have been registered, refresh our copy of the collection:
+ if(copiedSynchs.length != _synchs.size()) {
+ copiedSynchs = (SynchronizationRecord[])_synchs.toArray(new SynchronizationRecord[] {});
+ }
- lastIndexProcessed = lastIndexProcessed+1;
- _currentRecord = copiedSynchs[lastIndexProcessed];
+ lastIndexProcessed = lastIndexProcessed+1;
+ _currentRecord = copiedSynchs[lastIndexProcessed];
Synchronization c = _currentRecord.contents();
c.before_completion();
@@ -1529,27 +1529,27 @@
{ "ArjunaTransactionImple.doBeforeCompletion", e });
}
- if (!problem)
- {
- exp = e;
+ if (!problem)
+ {
+ exp = e;
- problem = true;
+ problem = true;
- /*
- * Mark as rollback_only, so when we try to commit it will
- * fail.
- */
+ /*
+ * Mark as rollback_only, so when we try to commit it will
+ * fail.
+ */
- try
- {
- rollback_only();
- }
- catch (Inactive ex)
- {
- /*
- * This should not happen. If it does, continue with
- * commit to tidy-up.
- */
+ try
+ {
+ rollback_only();
+ }
+ catch (Inactive ex)
+ {
+ /*
+ * This should not happen. If it does, continue with
+ * commit to tidy-up.
+ */
if (jtsLogger.loggerI18N.isWarnEnabled())
{
@@ -1567,28 +1567,35 @@
{
// OTSImpleManager.systemCurrent().resumeWrapper(cw);
- if (cw != null)
- OTSImpleManager.current().resumeWrapper(cw);
- else
- OTSImpleManager.current().suspend();
- }
- catch (Exception ex)
- {
- }
+ if (cw != null)
+ OTSImpleManager.current().resumeWrapper(cw);
+ else
+ OTSImpleManager.current().suspend();
+ }
+ catch (Exception ex)
+ {
+ }
- // OTSImpleManager.systemCurrent().suspend();
- }
- }
- }
+ // OTSImpleManager.systemCurrent().suspend();
+ }
+ }
+ }
- if (problem)
- {
- if (exp != null)
- throw exp;
- else
- throw new UNKNOWN(ExceptionCodes.SYNCHRONIZATION_EXCEPTION,
- CompletionStatus.COMPLETED_NO);
- }
+ /*
+ * If there's no problem so far then call beforeCompletion on the underlying TwoPhaseCoordinator.
+ */
+
+ if (!problem)
+ problem = !super.beforeCompletion();
+
+ if (problem)
+ {
+ if (exp != null)
+ throw exp;
+ else
+ throw new UNKNOWN(ExceptionCodes.SYNCHRONIZATION_EXCEPTION,
+ CompletionStatus.COMPLETED_NO);
+ }
}
/**
@@ -1616,67 +1623,67 @@
return;
}
- boolean problem = false;
- SystemException exp = null;
+ boolean problem = false;
+ SystemException exp = null;
- if (_synchs != null)
- {
- ControlWrapper cw = null;
- boolean doSuspend = false;
+ if (_synchs != null)
+ {
+ ControlWrapper cw = null;
+ boolean doSuspend = false;
- try
- {
- // cw = OTSImpleManager.systemCurrent().getControlWrapper();
+ try
+ {
+ // cw = OTSImpleManager.systemCurrent().getControlWrapper();
- cw = OTSImpleManager.current().getControlWrapper();
+ cw = OTSImpleManager.current().getControlWrapper();
- /*
- * If there isn't a transaction context shipped, then use the
- * one we had during creation.
- */
+ /*
+ * If there isn't a transaction context shipped, then use the
+ * one we had during creation.
+ */
- if ((cw == null) || (!controlHandle.equals(cw.getImple())))
- {
- // OTSImpleManager.systemCurrent().resumeImple(controlHandle);
+ if ((cw == null) || (!controlHandle.equals(cw.getImple())))
+ {
+ // OTSImpleManager.systemCurrent().resumeImple(controlHandle);
- OTSImpleManager.current().resumeImple(controlHandle);
+ OTSImpleManager.current().resumeImple(controlHandle);
- doSuspend = true;
- }
- }
- catch (Exception ex)
- {
- /*
- * It should still be OK to make the call without a context
- * because a Synchronization can only be associated with a
- * single transaction.
- */
+ doSuspend = true;
+ }
+ }
+ catch (Exception ex)
+ {
+ /*
+ * It should still be OK to make the call without a context
+ * because a Synchronization can only be associated with a
+ * single transaction.
+ */
- problem = true;
- }
+ problem = true;
+ }
- /*
- * Regardless of failures, we must tell all synchronizations what
- * happened.
- */
+ /*
+ * Regardless of failures, we must tell all synchronizations what
+ * happened.
+ */
- // afterCompletions should run in reverse order compared to beforeCompletions
- Stack stack = new Stack();
- Iterator iterator = _synchs.iterator();
- while(iterator.hasNext()) {
- stack.push(iterator.next());
- }
+ // afterCompletions should run in reverse order compared to beforeCompletions
+ Stack stack = new Stack();
+ Iterator iterator = _synchs.iterator();
+ while(iterator.hasNext()) {
+ stack.push(iterator.next());
+ }
- iterator = stack.iterator();
+ iterator = stack.iterator();
- /*
- * Regardless of failures, we must tell all synchronizations what
- * happened.
- */
- while(!stack.isEmpty())
- {
- SynchronizationRecord value = (SynchronizationRecord)stack.pop();
- Synchronization c = value.contents();
+ /*
+ * Regardless of failures, we must tell all synchronizations what
+ * happened.
+ */
+ while(!stack.isEmpty())
+ {
+ SynchronizationRecord value = (SynchronizationRecord)stack.pop();
+ Synchronization c = value.contents();
try
{
@@ -1690,46 +1697,49 @@
+ e);
}
- problem = true;
+ problem = true;
- /*
- * Remember the first exception we get, because it may well
- * be the only one. In which case we can return it, rather
- * than UNKNOWN.
- */
+ /*
+ * Remember the first exception we get, because it may well
+ * be the only one. In which case we can return it, rather
+ * than UNKNOWN.
+ */
- if (exp == null)
- exp = e;
- }
- }
+ if (exp == null)
+ exp = e;
+ }
+ }
- if (doSuspend)
- {
- try
- {
- // OTSImpleManager.systemCurrent().resumeWrapper(cw);
+ if (doSuspend)
+ {
+ try
+ {
+ // OTSImpleManager.systemCurrent().resumeWrapper(cw);
- if (cw != null)
- OTSImpleManager.current().resumeWrapper(cw);
- else
- OTSImpleManager.current().suspend();
- }
- catch (Exception ex)
- {
- }
- }
+ if (cw != null)
+ OTSImpleManager.current().resumeWrapper(cw);
+ else
+ OTSImpleManager.current().suspend();
+ }
+ catch (Exception ex)
+ {
+ }
+ }
- _synchs = null;
- }
+ _synchs = null;
+ }
- if (problem)
- {
- if (exp != null)
- throw exp;
- else
- throw new UNKNOWN(ExceptionCodes.SYNCHRONIZATION_EXCEPTION,
- CompletionStatus.COMPLETED_NO);
- }
+
+ boolean superProblem = !super.afterCompletion(myStatus == Status.StatusCommitted ? ActionStatus.COMMITTED : ActionStatus.ABORTED);
+
+ if (problem || superProblem)
+ {
+ if (exp != null)
+ throw exp;
+ else
+ throw new UNKNOWN(ExceptionCodes.SYNCHRONIZATION_EXCEPTION,
+ CompletionStatus.COMPLETED_NO);
+ }
}
/**
More information about the jboss-svn-commits
mailing list