ARTEMIS-4652 rollback of XAResource impl shouldn't return XA_RETRY

This fix was based on static analysis of the code and inspection of the
XA specification. There is no test associated with it due to the
difficult nature in reproducing the failure. This code has been
essentially the same for a decade and only now have there been any
reports of it actually sending back the wrong XA code.
This commit is contained in:
Justin Bertram 2024-02-20 15:17:57 -06:00 committed by clebertsuconic
parent d864780293
commit 269be13c5a
1 changed files with 3 additions and 11 deletions

View File

@ -1901,18 +1901,10 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
workDone = false;
} catch (XAException xae) {
throw xae;
} catch (ActiveMQException e) {
if (e.getType() == ActiveMQExceptionType.UNBLOCKED || e.getType() == ActiveMQExceptionType.CONNECTION_TIMEDOUT || e.getType() == ActiveMQExceptionType.SHUTDOWN_ERROR) {
// Unblocked on failover
throw new XAException(XAException.XA_RETRY);
}
// This should never occur
XAException xaException = new XAException(XAException.XAER_RMFAIL);
xaException.initCause(e);
throw xaException;
} catch (Throwable t) {
// This could occur if the TM interrupts the thread
if (logger.isTraceEnabled()) {
logger.trace("Rollback failed:: {}", convert(xid), t);
}
XAException xaException = new XAException(XAException.XAER_RMFAIL);
xaException.initCause(t);
throw xaException;