From 31ecfae93453e5a35d72322bf2e2bb5adcdeac5e Mon Sep 17 00:00:00 2001 From: Robert Davies Date: Mon, 14 Sep 2009 13:43:54 +0000 Subject: [PATCH] Fix for https://issues.apache.org/activemq/browse/AMQ-2385 git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@814639 13f79535-47bb-0310-9956-ffa450edef68 --- .../activemq/transport/failover/FailoverTransport.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java b/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java index e969333be8..b82e1295c0 100755 --- a/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java +++ b/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java @@ -762,7 +762,15 @@ public class FailoverTransport implements CompositeTransport { } } } - long reconnectAttempts = firstConnection ? this.startupMaxReconnectAttempts : this.maxReconnectAttempts; + int reconnectAttempts = 0; + if (firstConnection) { + if (this.startupMaxReconnectAttempts != 0) { + reconnectAttempts = this.startupMaxReconnectAttempts; + } + } + if (reconnectAttempts==0) { + reconnectAttempts = this.maxReconnectAttempts; + } if (reconnectAttempts > 0 && ++connectFailures >= reconnectAttempts) { LOG.error("Failed to connect to transport after: " + connectFailures + " attempt(s)"); connectionFailure = failure;