activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1393515 - /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp
Date Wed, 03 Oct 2012 14:46:06 GMT
Author: tabish
Date: Wed Oct  3 14:46:05 2012
New Revision: 1393515

URL: http://svn.apache.org/viewvc?rev=1393515&view=rev
Log:
Protect the sessions list during close from concurrent access.

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=1393515&r1=1393514&r2=1393515&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
Wed Oct  3 14:46:05 2012
@@ -591,6 +591,7 @@ void ActiveMQConnection::close() {
         }
 
         // Get the complete list of active sessions.
+        this->config->sessionsLock.writeLock().lock();
         std::auto_ptr< Iterator<Pointer<ActiveMQSessionKernel> > > iter(this->config->activeSessions.iterator());
 
         long long lastDeliveredSequenceId = 0;
@@ -601,9 +602,10 @@ void ActiveMQConnection::close() {
             try {
                 session->dispose();
                 lastDeliveredSequenceId = Math::max(lastDeliveredSequenceId, session->getLastDeliveredSequenceId());
-            } catch( cms::CMSException& ex ){
+            } catch (cms::CMSException& ex) {
             }
         }
+        this->config->sessionsLock.writeLock().unlock();
 
         // As TemporaryQueue and TemporaryTopic instances are bound to a connection
         // we should just delete them after the connection is closed to free up memory



Mime
View raw message