activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1445817 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core: ActiveMQSessionExecutor.cpp kernels/ActiveMQSessionKernel.cpp
Date Wed, 13 Feb 2013 18:39:09 GMT
Author: tabish
Date: Wed Feb 13 18:39:09 2013
New Revision: 1445817

URL: http://svn.apache.org/r1445817
Log:
additional fixes for: https://issues.apache.org/jira/browse/AMQCPP-460

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSessionExecutor.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSessionExecutor.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSessionExecutor.cpp?rev=1445817&r1=1445816&r2=1445817&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSessionExecutor.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSessionExecutor.cpp
Wed Feb 13 18:39:09 2013
@@ -51,21 +51,28 @@ ActiveMQSessionExecutor::ActiveMQSession
 ActiveMQSessionExecutor::~ActiveMQSessionExecutor() {
 
     try {
-
         // Terminate the thread.
         stop();
+    }
+    AMQ_CATCHALL_NOTHROW()
 
+    try {
         // Close out the Message Channel.
         close();
+    }
+    AMQ_CATCHALL_NOTHROW()
 
+    try {
         // Empty the message queue and destroy any remaining messages.
         clear();
+    }
+    AMQ_CATCHALL_NOTHROW()
 
+    try {
         // Ensure that we shutdown the taskRunner Thread before we are done.
-        Pointer<TaskRunner> taskRunner = this->taskRunner;
         if (taskRunner != NULL) {
-            this->taskRunner.reset(NULL);
             taskRunner->shutdown();
+            taskRunner.reset(NULL);
         }
     }
     AMQ_CATCHALL_NOTHROW()

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp?rev=1445817&r1=1445816&r2=1445817&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp
Wed Feb 13 18:39:09 2013
@@ -253,6 +253,14 @@ ActiveMQSessionKernel::~ActiveMQSessionK
     AMQ_CATCHALL_NOTHROW()
 
     try {
+        // Free the executor here so that its threads are gone before any of the
+        // other member data of this class is destroyed as it might be accessing
+        // from its run thread.
+        this->executor.reset(NULL);
+    }
+    AMQ_CATCHALL_NOTHROW()
+
+    try {
         delete this->config;
     }
     AMQ_CATCHALL_NOTHROW()
@@ -340,7 +348,7 @@ void ActiveMQSessionKernel::dispose() {
         }
     };
 
-    try{
+    try {
 
         Finalizer final(this, this->connection);
 
@@ -1335,6 +1343,10 @@ Pointer<ActiveMQConsumerKernel> ActiveMQ
 ////////////////////////////////////////////////////////////////////////////////
 bool ActiveMQSessionKernel::iterateConsumers() {
 
+    if (this->closed.get()) {
+        return false;
+    }
+
     this->config->consumerLock.readLock().lock();
     try {
         Pointer<Iterator< Pointer<ActiveMQConsumerKernel> > > iter(this->config->consumers.iterator());



Mime
View raw message