You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by nm...@apache.org on 2006/12/01 17:11:00 UTC

svn commit: r481269 - in /incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq: connector/stomp/StompConnector.cpp connector/stomp/StompConnector.h transport/IOTransport.cpp

Author: nmittler
Date: Fri Dec  1 08:10:59 2006
New Revision: 481269

URL: http://svn.apache.org/viewvc?view=rev&rev=481269
Log:
[AMQCPP-20] - cleanly shutdown (no logs or user notification) when client-initiated disconnect (via stomp disconnect message)

Modified:
    incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompConnector.cpp
    incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompConnector.h
    incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/IOTransport.cpp

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompConnector.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompConnector.cpp?view=diff&rev=481269&r1=481268&r2=481269
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompConnector.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompConnector.cpp Fri Dec  1 08:10:59 2006
@@ -47,6 +47,8 @@
 using namespace activemq::connector::stomp;
 using namespace activemq::connector::stomp::commands;
 
+LOGCMS_INITIALIZE(logger, StompConnector, "activemq.connector.stomp.StompConnector" )
+
 ////////////////////////////////////////////////////////////////////////////////
 StompConnector::StompConnector( Transport* transport, 
                                 const util::Properties& properties )
@@ -179,9 +181,7 @@
         {
             // Send the disconnect message to the broker.
             disconnect();
-
-            // Close the transport.
-            printf("StompConnector::close - about to close the transport\n");
+            
             transport->close();
         }
     }
@@ -770,14 +770,16 @@
 {
     try
     {
-        // Inform the user.
-        fire( ex );
+        // We're disconnected - the asynchronous error is expected.
+        if( state == DISCONNECTED ){
+            return;
+        }
         
-        // NOT closing here ... let the user close it through the connection
-        // class! 
+        // We were not closing - log the stack trace.
+        LOGCMS_WARN(logger, ex.getStackTraceString() );
         
-        // Close down.
-        //close();
+        // Inform the user of the error.
+        fire( ex );
     }
     AMQ_CATCH_RETHROW( ConnectorException )
     AMQ_CATCHALL_THROW( ConnectorException );

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompConnector.h
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompConnector.h?view=diff&rev=481269&r1=481268&r2=481269
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompConnector.h (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/stomp/StompConnector.h Fri Dec  1 08:10:59 2006
@@ -31,6 +31,7 @@
 #include <activemq/connector/stomp/commands/CommandConstants.h>
 #include <activemq/core/ActiveMQConstants.h>
 #include <activemq/exceptions/IllegalArgumentException.h>
+#include <activemq/logger/LoggerDefines.h>
 
 namespace activemq{
 namespace connector{
@@ -46,6 +47,9 @@
         public transport::TransportExceptionListener,
         public StompCommandListener
     {
+        
+        LOGCMS_DECLARE( logger )
+        
     private:
     
         // Flags the state we are in for connection to broker.

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/IOTransport.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/IOTransport.cpp?view=diff&rev=481269&r1=481268&r2=481269
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/IOTransport.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/IOTransport.cpp Fri Dec  1 08:10:59 2006
@@ -160,33 +160,20 @@
         }
         
     }
-    catch( activemq::io::IOException& ex ){
-
-        // This is expected for your typical broken socket - this
-        // is an error to be handled by the user, so let's not bother
-        // logging it - just inform the user through a callback.
-        ex.setMark( __FILE__, __LINE__ );        
-        fire( ex );
-    }
     catch( exceptions::ActiveMQException& ex ){
 
-        ex.setMark( __FILE__, __LINE__ );
-        
-        LOGCMS_WARN(logger, ex.getStackTraceString().c_str() )
-            
+        ex.setMark( __FILE__, __LINE__ );            
         fire( ex );
     }
     catch( ... ){
         
-        if( !closed ) {
-            exceptions::ActiveMQException ex( 
-                __FILE__, __LINE__, 
-                "IOTransport::run - caught unknown exception" );
-                
-            LOGCMS_WARN(logger, ex.getStackTraceString().c_str() )
+        exceptions::ActiveMQException ex( 
+            __FILE__, __LINE__, 
+            "IOTransport::run - caught unknown exception" );
 
-            fire( ex );
-        }
+        LOGCMS_WARN(logger, ex.getStackTraceString() );
+        
+        fire( ex );
     }
 }