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 randomize = true;
private boolean initialized; private boolean initialized;
private int maxReconnectAttempts; private int maxReconnectAttempts;
private int startupMaxReconnectAttempts;
private int connectFailures; private int connectFailures;
private long reconnectDelay = this.initialReconnectDelay; private long reconnectDelay = this.initialReconnectDelay;
private Exception connectionFailure; private Exception connectionFailure;
@ -316,6 +317,14 @@ public class FailoverTransport implements CompositeTransport {
public void setMaxReconnectAttempts(int maxReconnectAttempts) { public void setMaxReconnectAttempts(int maxReconnectAttempts) {
this.maxReconnectAttempts = maxReconnectAttempts; this.maxReconnectAttempts = maxReconnectAttempts;
} }
public int getStartupMaxReconnectAttempts() {
return this.startupMaxReconnectAttempts;
}
public void setStartupMaxReconnectAttempts(int startupMaxReconnectAttempts) {
this.startupMaxReconnectAttempts = startupMaxReconnectAttempts;
}
public long getTimeout() { public long getTimeout() {
return timeout; return timeout;
@ -753,8 +762,8 @@ public class FailoverTransport implements CompositeTransport {
} }
} }
} }
long reconnectAttempts = firstConnection ? this.startupMaxReconnectAttempts : this.maxReconnectAttempts;
if (maxReconnectAttempts > 0 && ++connectFailures >= maxReconnectAttempts) { if (reconnectAttempts > 0 && ++connectFailures >= reconnectAttempts) {
LOG.error("Failed to connect to transport after: " + connectFailures + " attempt(s)"); LOG.error("Failed to connect to transport after: " + connectFailures + " attempt(s)");
connectionFailure = failure; connectionFailure = failure;