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