Repository: activemq-artemis Updated Branches: refs/heads/master a349ebfab -> 4fade1073
[ARTEMIS-591] Wrong XAException return code when broker timeout is hit Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/3def84e5 Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/3def84e5 Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/3def84e5 Branch: refs/heads/master Commit: 3def84e5330099c786bc9a5301804ea839e1e8c4 Parents: a349ebf Author: bayern39 <[email protected]> Authored: Thu Jun 23 15:06:06 2016 +0800 Committer: Clebert Suconic <[email protected]> Committed: Mon Aug 15 14:08:50 2016 -0400 ---------------------------------------------------------------------- .../artemis/core/server/impl/ServerSessionImpl.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3def84e5/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java index c3d399a..f7c0a29 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java @@ -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;
