[jboss-svn-commits] JBL Code SVN: r25523 - in labs/jbosstm/trunk: ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/subordinate and 2 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Mar 6 08:46:32 EST 2009
Author: mark.little at jboss.com
Date: 2009-03-06 08:46:32 -0500 (Fri, 06 Mar 2009)
New Revision: 25523
Modified:
labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/jca/SubordinateTransaction.java
labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/jca/XATerminatorImple.java
labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/subordinate/TransactionImple.java
labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/jca/XATerminatorImple.java
labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/subordinate/SubordinateAtomicTransaction.java
labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/subordinate/TransactionImple.java
Log:
https://jira.jboss.org/jira/browse/JBTM-506, https://jira.jboss.org/jira/browse/JBTM-507, https://jira.jboss.org/jira/browse/JBTM-508
Modified: labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/jca/SubordinateTransaction.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/jca/SubordinateTransaction.java 2009-03-06 09:49:11 UTC (rev 25522)
+++ labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/jca/SubordinateTransaction.java 2009-03-06 13:46:32 UTC (rev 25523)
@@ -49,7 +49,7 @@
* @throws SystemException thrown if some other error occurs.
*/
public void doCommit () throws IllegalStateException,
- HeuristicMixedException, HeuristicRollbackException,
+ HeuristicMixedException, HeuristicRollbackException, HeuristicCommitException,
SystemException;
/**
@@ -66,7 +66,7 @@
* @throws SystemException thrown if any other error occurs.
*/
public void doRollback () throws IllegalStateException,
- HeuristicMixedException, HeuristicCommitException, SystemException;
+ HeuristicMixedException, HeuristicCommitException, HeuristicRollbackException, SystemException;
/**
* Drive the transaction to commit. It should not have been previously
@@ -77,7 +77,7 @@
* rolls back.
*/
public void doOnePhaseCommit () throws IllegalStateException,
- HeuristicRollbackException, SystemException, RollbackException;
+ HeuristicMixedException, SystemException, RollbackException;
/**
* Called to tell the transaction to forget any heuristics.
Modified: labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/jca/XATerminatorImple.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/jca/XATerminatorImple.java 2009-03-06 09:49:11 UTC (rev 25522)
+++ labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/jca/XATerminatorImple.java 2009-03-06 13:46:32 UTC (rev 25523)
@@ -114,6 +114,16 @@
{
throw new XAException(XAException.XA_HEURMIX);
}
+ catch (final HeuristicCommitException ex)
+ {
+ throw new XAException(XAException.XA_HEURCOM);
+ }
+ catch (final IllegalStateException ex)
+ {
+ SubordinationManager.getTransactionImporter().removeImportedTransaction(xid);
+
+ throw new XAException(XAException.XAER_NOTA);
+ }
catch (SystemException ex)
{
SubordinationManager.getTransactionImporter().removeImportedTransaction(xid);
@@ -186,7 +196,7 @@
case TwoPhaseOutcome.PREPARE_NOTOK:
// the JCA API spec limits what we can do in terms of reporting problems.
// try to use the exception code and cause to provide info whilst
- // ramining API compliant. JBTM-427.
+ // remaining API compliant. JBTM-427.
Exception initCause = null;
int xaExceptionCode = XAException.XA_RBROLLBACK;
try {
@@ -201,6 +211,11 @@
initCause = e;
xaExceptionCode = XAException.XAER_RMERR;
}
+ catch (final HeuristicRollbackException e) {
+ initCause = e;
+ xaExceptionCode = XAException.XAER_RMERR;
+ }
+
SubordinationManager.getTransactionImporter().removeImportedTransaction(xid);
XAException xaException = new XAException(xaExceptionCode);
if(initCause != null) {
@@ -209,6 +224,8 @@
throw xaException;
case TwoPhaseOutcome.PREPARE_OK:
return XAResource.XA_OK;
+ case TwoPhaseOutcome.INVALID_TRANSACTION:
+ throw new XAException(XAException.XAER_NOTA);
default:
throw new XAException(XAException.XA_RBOTHER);
}
@@ -374,6 +391,10 @@
throw ex;
}
+ catch (final HeuristicRollbackException exx)
+ {
+ throw new XAException(XAException.XA_HEURRB);
+ }
catch (HeuristicCommitException ex)
{
throw new XAException(XAException.XA_HEURCOM);
@@ -382,6 +403,12 @@
{
throw new XAException(XAException.XA_HEURMIX);
}
+ catch (final IllegalStateException ex)
+ {
+ SubordinationManager.getTransactionImporter().removeImportedTransaction(xid);
+
+ throw new XAException(XAException.XAER_NOTA);
+ }
catch (SystemException ex)
{
SubordinationManager.getTransactionImporter().removeImportedTransaction(xid);
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-03-06 09:49:11 UTC (rev 25522)
+++ labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/subordinate/TransactionImple.java 2009-03-06 13:46:32 UTC (rev 25523)
@@ -202,7 +202,7 @@
}
public void doRollback () throws IllegalStateException,
- HeuristicMixedException, HeuristicCommitException, SystemException
+ HeuristicMixedException, HeuristicCommitException, HeuristicRollbackException, SystemException
{
try
{
@@ -222,10 +222,11 @@
{
case ActionStatus.ABORTED:
case ActionStatus.ABORTING:
+ TransactionImple.removeTransaction(this);
+
+ break;
case ActionStatus.H_ROLLBACK:
- TransactionImple.removeTransaction(this);
-
- break;
+ throw new HeuristicRollbackException();
case ActionStatus.H_COMMIT:
throw new HeuristicCommitException();
case ActionStatus.H_HAZARD:
@@ -262,7 +263,7 @@
}
public void doOnePhaseCommit () throws IllegalStateException,
- javax.transaction.HeuristicRollbackException, javax.transaction.SystemException, RollbackException
+ javax.transaction.HeuristicMixedException, javax.transaction.SystemException, RollbackException
{
try
{
@@ -280,15 +281,17 @@
TransactionImple.removeTransaction(this);
break;
case ActionStatus.ABORTED:
+ case ActionStatus.ABORTING:
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.ABORTING:
+
case ActionStatus.H_HAZARD:
case ActionStatus.H_MIXED:
+ case ActionStatus.H_ROLLBACK:
default:
- throw new javax.transaction.HeuristicRollbackException();
+ throw new javax.transaction.HeuristicMixedException();
case ActionStatus.INVALID:
throw new InvalidTerminationStateException();
}
Modified: labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/jca/XATerminatorImple.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/jca/XATerminatorImple.java 2009-03-06 09:49:11 UTC (rev 25522)
+++ labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/jca/XATerminatorImple.java 2009-03-06 13:46:32 UTC (rev 25523)
@@ -96,6 +96,10 @@
throw ex;
}
+ catch (final HeuristicCommitException ex)
+ {
+ throw new XAException(XAException.XA_HEURCOM);
+ }
catch (HeuristicRollbackException ex)
{
throw new XAException(XAException.XA_HEURRB);
@@ -104,6 +108,12 @@
{
throw new XAException(XAException.XA_HEURMIX);
}
+ catch (final IllegalStateException ex)
+ {
+ SubordinationManager.getTransactionImporter().removeImportedTransaction(xid);
+
+ throw new XAException(XAException.XAER_NOTA);
+ }
catch (SystemException ex)
{
SubordinationManager.getTransactionImporter().removeImportedTransaction(xid);
@@ -149,19 +159,26 @@
return XAResource.XA_RDONLY;
case TwoPhaseOutcome.PREPARE_NOTOK:
- SubordinationManager.getTransactionImporter().removeImportedTransaction(xid); // TODO check if rollback is going to be called first
+ try
+ {
+ rollback(xid);
+ }
+ catch (final Throwable ex)
+ {
+ // if we failed to prepare then rollback should not fail!
+ }
+
+ SubordinationManager.getTransactionImporter().removeImportedTransaction(xid);
throw new XAException(XAException.XA_RBROLLBACK);
case TwoPhaseOutcome.PREPARE_OK:
return XAResource.XA_OK;
+ case TwoPhaseOutcome.INVALID_TRANSACTION:
+ throw new XAException(XAException.XAER_NOTA);
default:
throw new XAException(XAException.XA_RBOTHER);
}
}
- /*catch (SystemException ex)
- {
- throw new XAException(XAException.XAER_RMFAIL);
- }*/
catch (XAException ex)
{
throw ex;
@@ -303,10 +320,20 @@
{
throw new XAException(XAException.XA_HEURCOM);
}
+ catch (final HeuristicRollbackException exx)
+ {
+ throw new XAException(XAException.XA_HEURRB);
+ }
catch (HeuristicMixedException ex)
{
throw new XAException(XAException.XA_HEURMIX);
}
+ catch (final IllegalStateException ex)
+ {
+ SubordinationManager.getTransactionImporter().removeImportedTransaction(xid);
+
+ throw new XAException(XAException.XAER_NOTA);
+ }
catch (SystemException ex)
{
SubordinationManager.getTransactionImporter().removeImportedTransaction(xid);
Modified: labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/subordinate/SubordinateAtomicTransaction.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/subordinate/SubordinateAtomicTransaction.java 2009-03-06 09:49:11 UTC (rev 25522)
+++ labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/subordinate/SubordinateAtomicTransaction.java 2009-03-06 13:46:32 UTC (rev 25523)
@@ -123,7 +123,7 @@
// TODO error
- return TwoPhaseOutcome.ONE_PHASE_ERROR;
+ return ActionStatus.H_HAZARD;
}
/**
@@ -147,7 +147,7 @@
// TODO error
- return TwoPhaseOutcome.FINISH_ERROR;
+ return ActionStatus.H_HAZARD;
}
public int doOnePhaseCommit () throws SystemException
@@ -163,10 +163,10 @@
}
catch (Exception ex)
{
- return TwoPhaseOutcome.HEURISTIC_HAZARD;
+ return ActionStatus.H_HAZARD;
}
- return TwoPhaseOutcome.FINISH_OK;
+ return ActionStatus.COMMITTED;
}
public void doForget () throws SystemException
Modified: labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/subordinate/TransactionImple.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/subordinate/TransactionImple.java 2009-03-06 09:49:11 UTC (rev 25522)
+++ labs/jbosstm/trunk/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/transaction/jts/subordinate/TransactionImple.java 2009-03-06 13:46:32 UTC (rev 25523)
@@ -189,7 +189,7 @@
*/
public void doCommit () throws IllegalStateException,
- HeuristicMixedException, HeuristicRollbackException,
+ HeuristicMixedException, HeuristicRollbackException, HeuristicCommitException,
SystemException
{
try
@@ -200,17 +200,19 @@
switch (res)
{
- case TwoPhaseOutcome.FINISH_OK:
- case TwoPhaseOutcome.HEURISTIC_COMMIT:
+ case ActionStatus.H_COMMIT:
+ throw new HeuristicCommitException();
+ case ActionStatus.COMMITTED:
+ case ActionStatus.COMMITTING:
break;
- case TwoPhaseOutcome.HEURISTIC_ROLLBACK:
+ case ActionStatus.ABORTED:
+ case ActionStatus.ABORTING:
+ case ActionStatus.H_ROLLBACK:
throw new HeuristicRollbackException();
- case TwoPhaseOutcome.FINISH_ERROR:
- case TwoPhaseOutcome.HEURISTIC_HAZARD:
- case TwoPhaseOutcome.HEURISTIC_MIXED:
+ case ActionStatus.H_HAZARD:
+ case ActionStatus.H_MIXED:
throw new HeuristicMixedException();
- case TwoPhaseOutcome.INVALID_TRANSACTION:
- case TwoPhaseOutcome.NOT_PREPARED:
+ case ActionStatus.INVALID:
throw new IllegalStateException();
default:
throw new HeuristicMixedException(); // not sure what happened,
@@ -244,7 +246,7 @@
*/
public void doRollback () throws IllegalStateException,
- HeuristicMixedException, HeuristicCommitException, SystemException
+ HeuristicMixedException, HeuristicCommitException, HeuristicRollbackException, SystemException
{
try
{
@@ -262,13 +264,16 @@
switch (res)
{
- case TwoPhaseOutcome.FINISH_OK:
- case TwoPhaseOutcome.HEURISTIC_ROLLBACK:
- break;
- case TwoPhaseOutcome.HEURISTIC_COMMIT:
+ case ActionStatus.ABORTED:
+ case ActionStatus.ABORTING:
+ break;
+ case ActionStatus.H_ROLLBACK:
+ throw new HeuristicRollbackException();
+ case ActionStatus.H_COMMIT:
throw new HeuristicCommitException();
- case TwoPhaseOutcome.INVALID_TRANSACTION:
- throw new IllegalStateException();
+ case ActionStatus.H_HAZARD:
+ case ActionStatus.H_MIXED:
+ throw new HeuristicMixedException();
default:
throw new HeuristicMixedException();
}
@@ -295,7 +300,7 @@
*/
public void doOnePhaseCommit () throws IllegalStateException, javax.transaction.RollbackException,
- javax.transaction.HeuristicRollbackException, javax.transaction.SystemException
+ javax.transaction.HeuristicMixedException, javax.transaction.SystemException
{
try
{
@@ -319,20 +324,18 @@
switch (status)
{
- case TwoPhaseOutcome.FINISH_OK:
- case TwoPhaseOutcome.HEURISTIC_COMMIT:
+ case ActionStatus.COMMITTED:
+ case ActionStatus.H_COMMIT:
break;
- case TwoPhaseOutcome.FINISH_ERROR:
+ case ActionStatus.ABORTED:
+ case ActionStatus.ABORTING:
throw new RollbackException();
- case TwoPhaseOutcome.HEURISTIC_ROLLBACK:
- case TwoPhaseOutcome.HEURISTIC_HAZARD: // should never happen in the 1PC case!
- case TwoPhaseOutcome.HEURISTIC_MIXED:
+ case ActionStatus.H_ROLLBACK:
+ case ActionStatus.H_HAZARD:
+ case ActionStatus.H_MIXED:
default:
- // do not throw RollbackException in the case of a heuristic or heuristic resolution won't kick in later.
- throw new javax.transaction.HeuristicRollbackException();
- case TwoPhaseOutcome.INVALID_TRANSACTION:
- throw new IllegalStateException();
- case TwoPhaseOutcome.ONE_PHASE_ERROR:
+ throw new javax.transaction.HeuristicMixedException();
+ case ActionStatus.INVALID:
throw new InvalidTerminationStateException();
}
}
More information about the jboss-svn-commits
mailing list