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 21:54:16 UTC

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

Author: tabish
Date: Wed Oct  3 19:54:16 2012
New Revision: 1393733

URL: http://svn.apache.org/viewvc?rev=1393733&view=rev
Log:
Ensure that the close of connection trips the interrupt processing complete latch to prevent the transport command thread from touching deleted data. 

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=1393733&r1=1393732&r2=1393733&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 19:54:16 2012
@@ -666,6 +666,24 @@ void ActiveMQConnection::close() {
             }
         }
 
+        // Ensure that interruption processing completes in case any consumers were
+        // still in the process when we closed them.
+        try {
+            Pointer<CountDownLatch> latch = this->config->transportInterruptionProcessingComplete;
+            if (latch != NULL) {
+                int count = latch->getCount();
+                for (; count > 0; count--) {
+                    latch->countDown();
+                }
+            }
+        } catch (Exception& error) {
+            if (!hasException) {
+                ex = error;
+                ex.setMark(__FILE__, __LINE__);
+                hasException = true;
+            }
+        }
+
         // Now inform the Broker we are shutting down.
         try {
             this->disconnect(lastDeliveredSequenceId);