Author: rajdavies
Date: Mon Sep 14 13:39:32 2009
New Revision: 814638
URL: http://svn.apache.org/viewvc?rev=814638&view=rev
Log:
Fix for https://issues.apache.org/activemq/browse/AMQ-2385
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java?rev=814638&r1=814637&r2=814638&view=diff
==============================================================================
---
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
(original)
+++
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
Mon Sep 14 13:39:32 2009
@@ -85,6 +85,7 @@
private boolean randomize = true;
private boolean initialized;
private int maxReconnectAttempts;
+ private int startupMaxReconnectAttempts;
private int connectFailures;
private long reconnectDelay = this.initialReconnectDelay;
private Exception connectionFailure;
@@ -316,6 +317,14 @@
public void setMaxReconnectAttempts(int maxReconnectAttempts) {
this.maxReconnectAttempts = maxReconnectAttempts;
}
+
+ public int getStartupMaxReconnectAttempts() {
+ return this.startupMaxReconnectAttempts;
+ }
+
+ public void setStartupMaxReconnectAttempts(int
startupMaxReconnectAttempts) {
+ this.startupMaxReconnectAttempts = startupMaxReconnectAttempts;
+ }
public long getTimeout() {
return timeout;
@@ -753,8 +762,8 @@
}
}
}
-
- if (maxReconnectAttempts > 0 && ++connectFailures >=
maxReconnectAttempts) {
+ long reconnectAttempts = firstConnection ?
this.startupMaxReconnectAttempts : this.maxReconnectAttempts;
+ if (reconnectAttempts > 0 && ++connectFailures >=
reconnectAttempts) {
LOG.error("Failed to connect to transport after: " +
connectFailures + " attempt(s)");
connectionFailure = failure;