Permalink
Browse files

Merge pull request #681 from FranciscoBorges/warnings

Dead lock fix: cannot take the lock on failoverLock inside of interruptC...
  • Loading branch information...
2 parents 27afac0 + b25e021 commit eebdc23733083fbc2b4565c9df70dd30e315ab34 @clebertsuconic clebertsuconic committed Nov 16, 2012
@@ -42,6 +42,8 @@
import org.hornetq.api.core.client.FailoverEventType;
import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.api.core.client.SessionFailureListener;
+import org.hornetq.core.client.HornetQClientLogger;
+import org.hornetq.core.client.HornetQClientMessageBundle;
import org.hornetq.core.protocol.core.Channel;
import org.hornetq.core.protocol.core.ChannelHandler;
import org.hornetq.core.protocol.core.CoreRemotingConnection;
@@ -58,8 +60,6 @@
import org.hornetq.core.protocol.core.impl.wireformat.Ping;
import org.hornetq.core.protocol.core.impl.wireformat.SubscribeClusterTopologyUpdatesMessageV2;
import org.hornetq.core.remoting.FailureListener;
-import org.hornetq.core.client.HornetQClientLogger;
-import org.hornetq.core.client.HornetQClientMessageBundle;
import org.hornetq.core.server.HornetQComponent;
import org.hornetq.core.version.Version;
import org.hornetq.spi.core.protocol.ProtocolType;
@@ -490,22 +490,16 @@ private void interruptConnectAndCloseAllSessions(boolean close)
if (inCreateSessionLatch != null)
inCreateSessionLatch.countDown();
}
- forceReturnChannel1();
+ forceReturnChannel1();
// we need to stop the factory from connecting if it is in the middle of trying to failover before we get the lock
causeExit();
+
synchronized (createSessionLock)
{
closeCleanSessions(close);
- if (close) {
- synchronized (failoverLock)
- {
- closeCleanSessions(true);
- }
- }
+ closed = true;
}
-
- closed = true;
}
/**
@@ -899,6 +893,11 @@ private ClientSession createSessionInternal(final String username,
synchronized (sessions)
{
+ if (closed || exitLoop)
+ {
+ session.close();
+ return null;
+ }
sessions.add(session);
}

0 comments on commit eebdc23

Please sign in to comment.