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 2009/05/18 15:20:41 UTC

svn commit: r775938 - in /activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/core: ActiveMQConnection.cpp ActiveMQConnection.h

Author: tabish
Date: Mon May 18 13:20:40 2009
New Revision: 775938

URL: http://svn.apache.org/viewvc?rev=775938&view=rev
Log:
Fix for a socket read exception that can get propagated to exception listeners on close of the connection.  

Modified:
    activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/core/ActiveMQConnection.cpp
    activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/core/ActiveMQConnection.h

Modified: activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/core/ActiveMQConnection.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/core/ActiveMQConnection.cpp?rev=775938&r1=775937&r2=775938&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/core/ActiveMQConnection.cpp (original)
+++ activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/core/ActiveMQConnection.cpp Mon May 18 13:20:40 2009
@@ -38,6 +38,7 @@
     this->connectionData = connectionData;
     this->started = false;
     this->closed = false;
+    this->closing = false;
     this->exceptionListener = NULL;
 
     // Register for messages and exceptions from the connector.
@@ -132,6 +133,8 @@
             return;
         }
 
+        this->closing = true;
+
         // Get the complete list of active sessions.
         std::vector<ActiveMQSession*> allSessions;
         synchronized( &activeSessions ) {
@@ -257,7 +260,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 void ActiveMQConnection::onException( const CMSException& ex ){
 
-    if( exceptionListener != NULL ){
+    if( exceptionListener != NULL && !closing ){
         exceptionListener->onException( ex );
     }
 }

Modified: activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/core/ActiveMQConnection.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/core/ActiveMQConnection.h?rev=775938&r1=775937&r2=775938&view=diff
==============================================================================
--- activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/core/ActiveMQConnection.h (original)
+++ activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/activemq/core/ActiveMQConnection.h Mon May 18 13:20:40 2009
@@ -79,6 +79,11 @@
         bool closed;
 
         /**
+         * Indicates that a close is in progress.
+         */
+        bool closing;
+
+        /**
          * Map of message dispatchers indexed by consumer id.
          */
         decaf::util::Map< long long, Dispatcher* > dispatchers;