From 207d4cdee682b65f3c434b51f440b1b6c28eefbd Mon Sep 17 00:00:00 2001 From: gtully Date: Mon, 28 Jul 2014 15:54:12 +0100 Subject: [PATCH] https://issues.apache.org/jira/browse/AMQ-5080 - revert short circut of recover when failover transport is not connected - using maxstartupMaxReconnectAttempts=x provides a better alternative. tm recovery need not start a managed connection or call getConnection before a call to xaresource.recover --- .../org/apache/activemq/TransactionContext.java | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/activemq-client/src/main/java/org/apache/activemq/TransactionContext.java b/activemq-client/src/main/java/org/apache/activemq/TransactionContext.java index 8e36ed2c10..c86f448878 100755 --- a/activemq-client/src/main/java/org/apache/activemq/TransactionContext.java +++ b/activemq-client/src/main/java/org/apache/activemq/TransactionContext.java @@ -643,20 +643,11 @@ public class TransactionContext implements XAResource { } public Xid[] recover(int flag) throws XAException { - if (LOG.isDebugEnabled()) { - LOG.debug("Recover: " + flag); - } + LOG.debug("recover({})", flag); TransactionInfo info = new TransactionInfo(getConnectionId(), null, TransactionInfo.RECOVER); try { this.connection.checkClosedOrFailed(); - final FailoverTransport failoverTransport = this.connection.getTransport().narrow(FailoverTransport.class); - if (failoverTransport != null && !failoverTransport.isConnected()) { - // otherwise call will block on reconnect forfeting any app level periodic check - XAException xaException = new XAException("Failover transport not connected: " + this.getConnection()); - xaException.errorCode = XAException.XAER_RMERR; - throw xaException; - } this.connection.ensureConnectionInfoSent(); DataArrayResponse receipt = (DataArrayResponse)this.connection.syncSendPacket(info); @@ -668,7 +659,7 @@ public class TransactionContext implements XAResource { answer = new XATransactionId[data.length]; System.arraycopy(data, 0, answer, 0, data.length); } - LOG.trace("recover({})={}", flag, answer); + LOG.debug("recover({})={}", flag, answer); return answer; } catch (JMSException e) { throw toXAException(e);