git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@814638 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2009-09-14 13:39:32 +00:00
parent f3b1ea9cfb
commit 3720e847d1
1 changed files with 11 additions and 2 deletions

View File

@ -85,6 +85,7 @@ public class FailoverTransport implements CompositeTransport {
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 class FailoverTransport implements CompositeTransport {
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 @@ public class FailoverTransport implements CompositeTransport {
}
}
}
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;