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 2010/12/21 23:11:43 UTC

svn commit: r1051677 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover: FailoverTransport.cpp FailoverTransport.h

Author: tabish
Date: Tue Dec 21 22:11:43 2010
New Revision: 1051677

URL: http://svn.apache.org/viewvc?rev=1051677&view=rev
Log:
Update the failover transport to filter out stale message acks correctly. 

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.h

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.cpp?rev=1051677&r1=1051676&r2=1051677&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.cpp Tue Dec 21 22:11:43 2010
@@ -97,19 +97,6 @@ FailoverTransport::~FailoverTransport() 
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-bool FailoverTransport::isShutdownCommand( const Pointer<Command>& command ) const {
-
-    if( command != NULL ) {
-
-        if( command->isShutdownInfo() || command->isRemoveInfo() ) {
-            return true;
-        }
-    }
-
-    return false;
-}
-
-////////////////////////////////////////////////////////////////////////////////
 void FailoverTransport::add( const std::string& uri ) {
 
     try {
@@ -201,7 +188,7 @@ void FailoverTransport::oneway( const Po
 
         synchronized( &reconnectMutex ) {
 
-            if( isShutdownCommand( command ) && connectedTransport == NULL ) {
+            if( command != NULL && connectedTransport == NULL ) {
 
                 if( command->isShutdownInfo() ) {
                     // Skipping send of ShutdownInfo command when not connected.
@@ -211,9 +198,13 @@ void FailoverTransport::oneway( const Po
                 if( command->isRemoveInfo() || command->isMessageAck() ) {
                     // Simulate response to RemoveInfo command or Ack as they will be stale.
                     stateTracker.track( command );
-                    Pointer<Response> response( new Response() );
-                    response->setCorrelationId( command->getCommandId() );
-                    myTransportListener->onCommand( response );
+
+                    if( command->isResponseRequired() ) {
+                        Pointer<Response> response( new Response() );
+                        response->setCorrelationId( command->getCommandId() );
+                        myTransportListener->onCommand( response );
+                    }
+
                     return;
                 }
             }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.h?rev=1051677&r1=1051676&r2=1051677&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.h Tue Dec 21 22:11:43 2010
@@ -371,15 +371,6 @@ namespace failover {
     private:
 
         /**
-         * @param command
-         *      The Command object to check.
-         *
-         * @return Returns true if the command is one sent when a connection
-         *         is being closed.
-         */
-        bool isShutdownCommand( const Pointer<Command>& command ) const;
-
-        /**
          * Looks up the correct Factory and create a new Composite version of the
          * Transport requested.
          *