Add a check to the iterate() so that on failover - it's not possible

to iterate for ever if the transport has actually been stopped

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@373862 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2006-01-31 16:31:21 +00:00
parent 815b6c5d87
commit 3e7ebc2368
1 changed files with 14 additions and 15 deletions

View File

@ -170,22 +170,21 @@ public class FailoverTransport implements CompositeTransport {
}
}
try {
log.debug("Waiting " + reconnectDelay + " ms before attempting connection. ");
Thread.sleep(reconnectDelay);
if(!disposed){
try{
log.debug("Waiting "+reconnectDelay+" ms before attempting connection. ");
Thread.sleep(reconnectDelay);
}catch(InterruptedException e1){
Thread.currentThread().interrupt();
}
if(useExponentialBackOff){
// Exponential increment of reconnect delay.
reconnectDelay*=backOffMultiplier;
if(reconnectDelay>maxReconnectDelay)
reconnectDelay=maxReconnectDelay;
}
}
catch (InterruptedException e1) {
Thread.currentThread().interrupt();
}
if (useExponentialBackOff) {
// Exponential increment of reconnect delay.
reconnectDelay *= backOffMultiplier;
if (reconnectDelay > maxReconnectDelay)
reconnectDelay = maxReconnectDelay;
}
return true;
return !disposed;
}
});