mirror of https://github.com/apache/activemq.git
Don't attempt to reconnect if serverSessionPool is closing
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@374118 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7f634906d0
commit
d8bdbe7a7c
|
@ -232,24 +232,23 @@ public class ActiveMQEndpointWorker {
|
||||||
connection=null;
|
connection=null;
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized private void reconnect(JMSException error) {
|
synchronized private void reconnect(JMSException error){
|
||||||
log.debug("Reconnect cause: ", error);
|
if(!serverSessionPool.isClosing()){
|
||||||
// Only log errors if the server is really down.. And not a temp failure.
|
log.debug("Reconnect cause: ",error);
|
||||||
if( reconnectDelay == MAX_RECONNECT_DELAY ) {
|
// Only log errors if the server is really down.. And not a temp failure.
|
||||||
log.info("Endpoint connection to JMS broker failed: "+error.getMessage());
|
if(reconnectDelay==MAX_RECONNECT_DELAY){
|
||||||
log.info("Endpoint will try to reconnect to the JMS broker in "+(MAX_RECONNECT_DELAY/1000)+" seconds");
|
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 {
|
}
|
||||||
disconnect();
|
try{
|
||||||
Thread.sleep(reconnectDelay);
|
disconnect();
|
||||||
|
Thread.sleep(reconnectDelay);
|
||||||
// Use exponential rollback.
|
// Use exponential rollback.
|
||||||
reconnectDelay*=2;
|
reconnectDelay*=2;
|
||||||
if( reconnectDelay > MAX_RECONNECT_DELAY )
|
if(reconnectDelay>MAX_RECONNECT_DELAY)
|
||||||
reconnectDelay = MAX_RECONNECT_DELAY;
|
reconnectDelay=MAX_RECONNECT_DELAY;
|
||||||
|
connect();
|
||||||
connect();
|
}catch(InterruptedException e){}
|
||||||
} catch (InterruptedException e) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -199,4 +199,18 @@ public class ServerSessionPoolImpl implements ServerSessionPool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Returns the closing.
|
||||||
|
*/
|
||||||
|
public boolean isClosing(){
|
||||||
|
return closing;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param closing The closing to set.
|
||||||
|
*/
|
||||||
|
public void setClosing(boolean closing){
|
||||||
|
this.closing=closing;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue