Skip to content
Permalink
Browse files
GERONIMO-5648 fix some errors in RollbackTask shown by osgi tx tests
  • Loading branch information
djencks committed Oct 30, 2010
1 parent f2c372d commit f8d6c00021a524926ac8fd0f4ac5fa2ea4c0e10e
Showing 2 changed files with 9 additions and 10 deletions.
@@ -90,7 +90,7 @@ public void run() {
} else if (e.errorCode == XAException.XAER_RMFAIL) {
//refresh the xa resource from the NamedXAResourceFactory
if (manager.getCommitter() instanceof NamedXAResource) {
String xaResourceName = ((NamedXAResource)manager.getCommitter()).getName();
String xaResourceName = manager.getResourceName();
NamedXAResourceFactory namedXAResourceFactory = txManager.getNamedXAResourceFactory(xaResourceName);
if (namedXAResourceFactory != null) {
try {
@@ -52,6 +52,7 @@ public RollbackTask(Xid xid, List<TransactionBranch> rms, Object logMark, Transa
this.txManager = txManager;
}

@Override
public void run() {
synchronized (this) {
status = Status.STATUS_ROLLING_BACK;
@@ -66,7 +67,10 @@ public void run() {
} catch (XAException e) {
log.error("Unexpected exception committing " + manager.getCommitter() + "; continuing to commit other RMs", e);

if (e.errorCode == XAException.XA_HEURRB) {
if (e.errorCode >= XAException.XA_RBBASE && e.errorCode <= XAException.XA_RBEND || e.errorCode == XAException.XAER_NOTA) {
remove(index);
everRolledBack = true;
} else if (e.errorCode == XAException.XA_HEURRB) {
remove(index);
// let's not throw an exception as the transaction has been rolled back
log.info("Transaction has been heuristically rolled back");
@@ -86,10 +90,10 @@ public void run() {
} else if (e.errorCode == XAException.XA_RETRY) {
// do nothing, retry later
index++;
} else if (e.errorCode == XAException.XAER_RMFAIL) {
} else if (e.errorCode == XAException.XAER_RMFAIL || e.errorCode == XAException.XAER_RMERR) {
//refresh the xa resource from the NamedXAResourceFactory
if (manager.getCommitter() instanceof NamedXAResource) {
String xaResourceName = ((NamedXAResource)manager.getCommitter()).getName();
String xaResourceName = manager.getResourceName();
NamedXAResourceFactory namedXAResourceFactory = txManager.getNamedXAResourceFactory(xaResourceName);
if (namedXAResourceFactory != null) {
try {
@@ -106,15 +110,10 @@ public void run() {
index++;
}
} else {
//no hope
//no hope. Since we don't record the exception if we do manage to retry stuff later, presumably we shouldn't now, either.
remove(index);
cause = e;
}
} else {
//at least these error codes:
// XAException.XA_RMERR
// XAException.XA_RBROLLBACK
// XAException.XAER_NOTA
//nothing we can do about it
remove(index);
cause = e;

0 comments on commit f8d6c00

Please sign in to comment.