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/03 16:46:06 UTC
svn commit: r1393515 -
/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp
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