activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject activemq-cpp git commit: https://issues.apache.org/jira/browse/AMQCPP-553
Date Tue, 14 Jul 2015 22:23:42 GMT
Repository: activemq-cpp
Updated Branches:
  refs/heads/master 5b42ee9d3 -> 8b607b49b


https://issues.apache.org/jira/browse/AMQCPP-553

Fix a leak that occurs when consumers are closed but they leave some
audit data in the ConnectionAudit instance..

Project: http://git-wip-us.apache.org/repos/asf/activemq-cpp/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-cpp/commit/8b607b49
Tree: http://git-wip-us.apache.org/repos/asf/activemq-cpp/tree/8b607b49
Diff: http://git-wip-us.apache.org/repos/asf/activemq-cpp/diff/8b607b49

Branch: refs/heads/master
Commit: 8b607b49bf4ceeff981e70b05955f34040e6a99d
Parents: 5b42ee9
Author: Timothy Bish <tabish121@gmail.com>
Authored: Tue Jul 14 18:23:34 2015 -0400
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Tue Jul 14 18:23:34 2015 -0400

----------------------------------------------------------------------
 activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp   | 5 +++++
 activemq-cpp/src/main/activemq/core/ActiveMQConnection.h     | 8 ++++++++
 activemq-cpp/src/main/activemq/core/ConnectionAudit.cpp      | 5 ++++-
 .../src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp | 5 +++--
 4 files changed, 20 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/8b607b49/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp b/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp
index 914b2c2..6bfed72 100644
--- a/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp
+++ b/activemq-cpp/src/main/activemq/core/ActiveMQConnection.cpp
@@ -1909,6 +1909,11 @@ bool ActiveMQConnection::isDuplicate(Dispatcher* dispatcher, Pointer<commands::M
 }
 
 ////////////////////////////////////////////////////////////////////////////////
+void ActiveMQConnection::removeAuditedDispatcher(Dispatcher* dispatcher) {
+    this->config->connectionAudit.removeDispatcher(dispatcher);
+}
+
+////////////////////////////////////////////////////////////////////////////////
 void ActiveMQConnection::rollbackDuplicate(Dispatcher* dispatcher, Pointer<commands::Message>
message) {
     this->config->connectionAudit.rollbackDuplicate(dispatcher, message);
 }

http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/8b607b49/activemq-cpp/src/main/activemq/core/ActiveMQConnection.h
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/activemq/core/ActiveMQConnection.h b/activemq-cpp/src/main/activemq/core/ActiveMQConnection.h
index 12fd1d4..727ca69 100644
--- a/activemq-cpp/src/main/activemq/core/ActiveMQConnection.h
+++ b/activemq-cpp/src/main/activemq/core/ActiveMQConnection.h
@@ -260,6 +260,14 @@ namespace core {
          */
         void rollbackDuplicate(Dispatcher* dispatcher, Pointer<commands::Message> message);
 
+        /**
+         * Removes the Audit information stored for a given MessageConsumer
+         *
+         * @param dispatcher
+         *      The Dispatcher instance that has received the Message.
+         */
+        void removeAuditedDispatcher(Dispatcher* dispatcher);
+
     public:   // Connection Interface Methods
 
         /**

http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/8b607b49/activemq-cpp/src/main/activemq/core/ConnectionAudit.cpp
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/activemq/core/ConnectionAudit.cpp b/activemq-cpp/src/main/activemq/core/ConnectionAudit.cpp
index 40b8cde..d2af6dc 100644
--- a/activemq-cpp/src/main/activemq/core/ConnectionAudit.cpp
+++ b/activemq-cpp/src/main/activemq/core/ConnectionAudit.cpp
@@ -84,7 +84,10 @@ ConnectionAudit::~ConnectionAudit() {
 ////////////////////////////////////////////////////////////////////////////////
 void ConnectionAudit::removeDispatcher(Dispatcher* dispatcher) {
     synchronized(&this->impl->mutex) {
-        this->impl->dispatchers.remove(dispatcher);
+        try {
+            this->impl->dispatchers.remove(dispatcher);
+        } catch (NoSuchElementException& ex) {
+        }
     }
 }
 

http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/8b607b49/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp b/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp
index 949d51b..aaf0a38 100644
--- a/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp
+++ b/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp
@@ -656,7 +656,7 @@ cms::MessageConsumer* ActiveMQSessionKernel::createDurableConsumer(const
cms::To
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-cms::MessageProducer* ActiveMQSessionKernel::createProducer( const cms::Destination* destination
) {
+cms::MessageProducer* ActiveMQSessionKernel::createProducer(const cms::Destination* destination
) {
 
     try {
 
@@ -702,7 +702,7 @@ cms::MessageProducer* ActiveMQSessionKernel::createProducer( const cms::Destinat
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-cms::QueueBrowser* ActiveMQSessionKernel::createBrowser( const cms::Queue* queue ) {
+cms::QueueBrowser* ActiveMQSessionKernel::createBrowser(const cms::Queue* queue ) {
 
     try {
         return ActiveMQSessionKernel::createBrowser(queue, "");
@@ -1271,6 +1271,7 @@ void ActiveMQSessionKernel::removeConsumer(Pointer<ActiveMQConsumerKernel>
consu
         this->config->consumerLock.writeLock().lock();
         try {
             this->config->consumers.remove(consumer);
+            this->connection->removeAuditedDispatcher(consumer.get());
             this->config->consumerLock.writeLock().unlock();
         } catch (Exception& ex) {
             this->config->consumerLock.writeLock().unlock();


Mime
View raw message