[Mulgara-svn] r1350 - trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi
ronald at mulgara.org
ronald at mulgara.org
Thu Oct 23 13:11:54 UTC 2008
Author: ronald
Date: 2008-10-23 06:11:53 -0700 (Thu, 23 Oct 2008)
New Revision: 1350
Modified:
trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/AbstractXAResource.java
Log:
Let the transaction-manager handle rolling back:
* cleaned out rollback flag and associated rollback calls
* don't explicitly roll back on a failed prepare(); this also fixes the
problem of rollback being invoked even when prepare threw a XA_RB
Modified: trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/AbstractXAResource.java
===================================================================
--- trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/AbstractXAResource.java 2008-10-23 13:11:47 UTC (rev 1349)
+++ trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/AbstractXAResource.java 2008-10-23 13:11:53 UTC (rev 1350)
@@ -128,9 +128,6 @@
break;
default:
- // XXX: is this correct? Or should we actually roll back here?
- if (tx != null)
- tx.rollback = true;
logger.error("Unrecognised flags in start: xid=" + formatXid(xid) + " flags=" + formatFlags(flags));
throw new XAException(XAException.XAER_INVAL);
}
@@ -165,12 +162,6 @@
T tx = getTxn(xid, "prepare");
- if (tx.rollback) {
- logger.info("Attempting to prepare in failed transaction");
- rollback(xid);
- throw new XAException(XAException.XA_RBROLLBACK);
- }
-
try {
int sts = doPrepare(tx);
if (sts == XA_RDONLY)
@@ -178,8 +169,8 @@
return sts;
} catch (Throwable t) {
logger.warn("Attempt to prepare failed", t);
- rollback(xid);
- throw new XAException(XAException.XA_RBROLLBACK);
+ reThrow(t, tx, true);
+ throw new Error("dummy for the compiler - never reached");
}
}
@@ -190,12 +181,6 @@
T tx = getTxn(xid, "commit");
- if (tx.rollback) {
- logger.error("Attempting to commit in failed transaction");
- rollback(xid);
- throw new XAException(XAException.XA_RBROLLBACK);
- }
-
try {
if (onePhase) {
int sts = doPrepare(tx);
@@ -406,8 +391,6 @@
public static class TxInfo {
/** the underlying Xid of this transaction; not valid till the first start() */
public Xid xid;
- /** true if this transaction has been marked for rollback */
- public boolean rollback;
}
/**
More information about the Mulgara-svn
mailing list