Need to check if the server pool is closing before calling reconnect, as the method is synchronized and can cause deadlocks

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@374119 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Guillaume Nodet 2006-02-01 17:29:05 +00:00
parent d8bdbe7a7c
commit d1b05c4f23
1 changed files with 17 additions and 17 deletions

View File

@ -145,8 +145,10 @@ public class ActiveMQEndpointWorker {
connection.start(); connection.start();
connection.setExceptionListener(new ExceptionListener() { connection.setExceptionListener(new ExceptionListener() {
public void onException(JMSException error) { public void onException(JMSException error) {
if (!serverSessionPool.isClosing()) {
reconnect(error); reconnect(error);
} }
}
}); });
if (activationSpec.isDurableSubscription()) { if (activationSpec.isDurableSubscription()) {
@ -233,7 +235,6 @@ public class ActiveMQEndpointWorker {
} }
synchronized private void reconnect(JMSException error){ synchronized private void reconnect(JMSException error){
if(!serverSessionPool.isClosing()){
log.debug("Reconnect cause: ",error); log.debug("Reconnect cause: ",error);
// Only log errors if the server is really down.. And not a temp failure. // Only log errors if the server is really down.. And not a temp failure.
if (reconnectDelay == MAX_RECONNECT_DELAY) { if (reconnectDelay == MAX_RECONNECT_DELAY) {
@ -250,7 +251,6 @@ public class ActiveMQEndpointWorker {
connect(); connect();
} catch(InterruptedException e) {} } catch(InterruptedException e) {}
} }
}
protected void registerThreadSession(Session session) { protected void registerThreadSession(Session session) {
threadLocal.set(session); threadLocal.set(session);