[jboss-svn-commits] JBL Code SVN: r18025 - in labs/jbosstm/branches/JBOSSTS_4_2_3_GA_CP: ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/resources/jts/orbspecific and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Jan 22 05:41:13 EST 2008
Author: jhalliday
Date: 2008-01-22 05:41:13 -0500 (Tue, 22 Jan 2008)
New Revision: 18025
Modified:
labs/jbosstm/branches/JBOSSTS_4_2_3_GA_CP/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/resources/arjunacore/XAResourceRecord.java
labs/jbosstm/branches/JBOSSTS_4_2_3_GA_CP/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/resources/jts/orbspecific/XAResourceRecord.java
Log:
merge xa_prepare error handling improvements from the 4.2.3.SP branch. http://jira.jboss.com/jira/browse/JBTM-307
Modified: labs/jbosstm/branches/JBOSSTS_4_2_3_GA_CP/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/resources/arjunacore/XAResourceRecord.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_2_3_GA_CP/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/resources/arjunacore/XAResourceRecord.java 2008-01-22 10:38:05 UTC (rev 18024)
+++ labs/jbosstm/branches/JBOSSTS_4_2_3_GA_CP/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/resources/arjunacore/XAResourceRecord.java 2008-01-22 10:41:13 UTC (rev 18025)
@@ -1,20 +1,20 @@
/*
* 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.
*/
@@ -89,7 +89,7 @@
* The params represent specific parameters we need to recreate the
* connection to the database in the event of a failure. If they're not set
* then recovery is out of our control.
- *
+ *
* Could also use it to pass other information, such as the readonly flag.
*/
@@ -279,7 +279,7 @@
{ "XAResourceRecord.prepare", XAHelper
.printXAErrorCode(e1) });
}
-
+
/*
* XA_RB*, XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or
* XAER_PROTO.
@@ -288,10 +288,25 @@
if (_rollbackOptimization) // won't have rollback called on it
removeConnection();
- if ((e1.errorCode == XAException.XAER_RMERR) || (e1.errorCode == XAException.XAER_RMFAIL))
- return TwoPhaseOutcome.HEURISTIC_HAZARD;
-
- return TwoPhaseOutcome.PREPARE_NOTOK;
+ switch (e1.errorCode)
+ {
+ case XAException.XAER_RMERR:
+ case XAException.XAER_RMFAIL:
+ case XAException.XA_RBROLLBACK:
+ case XAException.XA_RBEND:
+ case XAException.XA_RBCOMMFAIL:
+ case XAException.XA_RBDEADLOCK:
+ case XAException.XA_RBINTEGRITY:
+ case XAException.XA_RBOTHER:
+ case XAException.XA_RBPROTO:
+ case XAException.XA_RBTIMEOUT:
+ case XAException.XAER_INVAL:
+ case XAException.XAER_PROTO:
+ case XAException.XAER_NOTA: // resource may have arbitrarily rolled back (shouldn't, but ...)
+ return TwoPhaseOutcome.PREPARE_NOTOK;
+ default:
+ return TwoPhaseOutcome.HEURISTIC_HAZARD; // we're not really sure (shouldn't get here though).
+ }
}
catch (Exception e2)
{
@@ -511,7 +526,7 @@
* XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or
* XAER_PROTO.
*/
-
+
switch (e1.errorCode)
{
case XAException.XA_HEURHAZ:
@@ -582,7 +597,7 @@
* outcome is whatever we want. Therefore, we do not need to save any
* additional recoverable state, such as a reference to the transaction
* coordinator, since it will not have an intentions list anyway.
- *
+ *
* @message com.arjuna.ats.internal.jta.resources.arjunacore.opcnulltx
* [com.arjuna.ats.internal.jta.resources.arjunacore.opcnulltx] {0} -
* null transaction!
@@ -627,7 +642,7 @@
* TODO in Oracle the end is not needed. Is this common
* across other RMs?
*/
-
+
if (endAssociation())
{
_theXAResource.end(_tranID, XAResource.TMSUCCESS);
@@ -724,7 +739,7 @@
return true;
}
-
+
private void forget()
{
if ((_theXAResource != null) && (_tranID != null))
@@ -914,7 +929,7 @@
jtaLogger.loggerI18N.warn("com.arjuna.ats.internal.jta.resources.arjunacore.restorestate",
ex);
}
-
+
return false;
}
}
@@ -925,11 +940,13 @@
*/
_theXAResource = getNewXAResource();
-
+
if (_theXAResource == null)
{
jtaLogger.loggerI18N.warn("com.arjuna.ats.internal.jta.resources.arjunacore.norecoveryxa",
new Object[]{_tranID});
+
+ //return false;
}
}
}
@@ -1062,6 +1079,8 @@
RecoveryManager recMan = RecoveryManager.manager();
Vector recoveryModules = recMan.getModules();
+ System.err.println("**recoveryModules "+recoveryModules);
+
if (recoveryModules != null)
{
Enumeration modules = recoveryModules.elements();
@@ -1112,7 +1131,7 @@
if (_theTransaction.getXAResourceState(_theXAResource) == TxInfo.NOT_ASSOCIATED)
{
// end has been called so we don't need to do it again!
-
+
doEnd = false;
}
}
Modified: labs/jbosstm/branches/JBOSSTS_4_2_3_GA_CP/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/resources/jts/orbspecific/XAResourceRecord.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_2_3_GA_CP/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/resources/jts/orbspecific/XAResourceRecord.java 2008-01-22 10:38:05 UTC (rev 18024)
+++ labs/jbosstm/branches/JBOSSTS_4_2_3_GA_CP/ArjunaJTS/jtax/classes/com/arjuna/ats/internal/jta/resources/jts/orbspecific/XAResourceRecord.java 2008-01-22 10:41:13 UTC (rev 18025)
@@ -286,10 +286,25 @@
if (_rollbackOptimization) // won't have rollback called on it
removeConnection();
- if ((e1.errorCode == XAException.XAER_RMERR) || (e1.errorCode == XAException.XAER_RMFAIL))
- throw new HeuristicHazard();
-
- return Vote.VoteRollback;
+ switch (e1.errorCode)
+ {
+ case XAException.XAER_RMERR:
+ case XAException.XAER_RMFAIL:
+ case XAException.XA_RBROLLBACK:
+ case XAException.XA_RBEND:
+ case XAException.XA_RBCOMMFAIL:
+ case XAException.XA_RBDEADLOCK:
+ case XAException.XA_RBINTEGRITY:
+ case XAException.XA_RBOTHER:
+ case XAException.XA_RBPROTO:
+ case XAException.XA_RBTIMEOUT:
+ case XAException.XAER_INVAL:
+ case XAException.XAER_PROTO:
+ case XAException.XAER_NOTA: // resource may have arbitrarily rolled back (shouldn't, but ...)
+ return Vote.VoteRollback;
+ default:
+ throw new HeuristicHazard(); // we're not really sure (shouldn't get here though).
+ }
}
catch (Exception e2)
{
More information about the jboss-svn-commits
mailing list