[ARTEMIS-591] Wrong XAException return code when broker timeout is hit

This commit is contained in:
bayern39 2016-06-23 15:06:06 +08:00 committed by Clebert Suconic
parent a349ebfab5
commit 3def84e533
1 changed files with 8 additions and 1 deletions

View File

@ -855,10 +855,17 @@ public class ServerSessionImpl implements ServerSession, FailureListener {
else if (tx.getState() == Transaction.State.ROLLEDBACK) { else if (tx.getState() == Transaction.State.ROLLEDBACK) {
final String msg = "Cannot end, transaction is rolled back"; final String msg = "Cannot end, transaction is rolled back";
final long now = System.currentTimeMillis();
final boolean timeout = tx.hasTimedOut(now, resourceManager.getTimeoutSeconds());
tx = null; tx = null;
if (timeout) {
throw new ActiveMQXAException(XAException.XA_RBTIMEOUT, msg);
}
else {
throw new ActiveMQXAException(XAException.XAER_PROTO, msg); throw new ActiveMQXAException(XAException.XAER_PROTO, msg);
} }
}
else { else {
tx = null; tx = null;
} }