git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@391694 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2006-04-05 18:12:05 +00:00
parent 3b1a7d66de
commit 97f2ca1eef
1 changed files with 16 additions and 9 deletions

View File

@ -234,20 +234,27 @@ public class ActiveMQEndpointWorker {
connection=null; connection=null;
} }
synchronized private void reconnect(JMSException error){ private void reconnect(JMSException error){
log.debug("Reconnect cause: ",error); log.debug("Reconnect cause: ",error);
// Only log errors if the server is really down.. And not a temp failure. long reconnectDelay;
if (reconnectDelay == MAX_RECONNECT_DELAY) { synchronized(this) {
log.info("Endpoint connection to JMS broker failed: " + error.getMessage()); reconnectDelay = this.reconnectDelay;
log.info("Endpoint will try to reconnect to the JMS broker in "+(MAX_RECONNECT_DELAY/1000)+" seconds"); // Only log errors if the server is really down.. And not a temp failure.
if (reconnectDelay == MAX_RECONNECT_DELAY) {
log.info("Endpoint connection to JMS broker failed: " + error.getMessage());
log.info("Endpoint will try to reconnect to the JMS broker in "+(MAX_RECONNECT_DELAY/1000)+" seconds");
}
} }
try { try {
disconnect(); disconnect();
Thread.sleep(reconnectDelay); Thread.sleep(reconnectDelay);
// Use exponential rollback.
reconnectDelay*=2; synchronized(this) {
if (reconnectDelay > MAX_RECONNECT_DELAY) // Use exponential rollback.
reconnectDelay=MAX_RECONNECT_DELAY; this.reconnectDelay*=2;
if (this.reconnectDelay > MAX_RECONNECT_DELAY)
this.reconnectDelay=MAX_RECONNECT_DELAY;
}
connect(); connect();
} catch(InterruptedException e) {} } catch(InterruptedException e) {}
} }