You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2012/10/01 22:33:41 UTC

svn commit: r1392572 - /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp

Author: tabish
Date: Mon Oct  1 20:33:41 2012
New Revision: 1392572

URL: http://svn.apache.org/viewvc?rev=1392572&view=rev
Log:
fix for possible deadlock when async exception closes down Connection.

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp?rev=1392572&r1=1392571&r2=1392572&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp Mon Oct  1 20:33:41 2012
@@ -512,7 +512,7 @@ void ActiveMQConnection::setClientID( co
     this->config->userSpecifiedClientID = true;
 
     try {
-    	ensureConnectionInfoSent();
+        ensureConnectionInfoSent();
     }
     AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
 }
@@ -643,7 +643,7 @@ void ActiveMQConnection::cleanup() {
 
     try {
 
-        this->config->sessionsLock.readLock().lock();
+        this->config->sessionsLock.writeLock().lock();
         try {
             // Get the complete list of active sessions.
             std::auto_ptr< Iterator< Pointer<ActiveMQSessionKernel> > > iter( this->config->activeSessions.iterator() );
@@ -657,9 +657,9 @@ void ActiveMQConnection::cleanup() {
                     /* Absorb */
                 }
             }
-            this->config->sessionsLock.readLock().unlock();
+            this->config->sessionsLock.writeLock().unlock();
         } catch (Exception& ex) {
-            this->config->sessionsLock.readLock().unlock();
+            this->config->sessionsLock.writeLock().unlock();
             throw;
         }