activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r755373 - in /activemq/activemq-cpp/trunk/src/main/activemq/transport/failover: FailoverTransport.cpp FailoverTransportListener.cpp
Date Tue, 17 Mar 2009 20:00:53 GMT
Author: tabish
Date: Tue Mar 17 20:00:52 2009
New Revision: 755373

URL: http://svn.apache.org/viewvc?rev=755373&view=rev
Log:
http://issues.apache.org/activemq/browse/AMQCPP-100

Fix an error in the oneway method that didn't break out of the send loop if the state tracker
threw an exception.

Fix an error in the FailoverTransportListener's onCommand method that didn't catch NoSuchElementException
error when attempting to remove a request from the request map for response to commands that
aren't Message objects

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

Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransport.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransport.cpp?rev=755373&r1=755372&r2=755373&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransport.cpp
(original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransport.cpp
Tue Mar 17 20:00:52 2009
@@ -261,17 +261,22 @@
                         break;
                     }
 
-                    // If it was a request and it was not being tracked by
-                    // the state tracker,
-                    // then hold it in the requestMap so that we can replay
+                    // If it was a request and it was not being tracked by the state
+                    // tracker, then hold it in the requestMap so that we can replay
                     // it later.
-                    Pointer<Tracked> tracked = stateTracker.track( command );
-                    synchronized( &requestMap ) {
-                        if( tracked != NULL && tracked->isWaitingForResponse()
) {
-                            requestMap.put( command->getCommandId(), tracked );
-                        } else if( tracked == NULL && command->isResponseRequired()
) {
-                            requestMap.put( command->getCommandId(), command );
+                    Pointer<Tracked> tracked;
+                    try{
+                        tracked = stateTracker.track( command );
+                        synchronized( &requestMap ) {
+                            if( tracked != NULL && tracked->isWaitingForResponse()
) {
+                                requestMap.put( command->getCommandId(), tracked );
+                            } else if( tracked == NULL && command->isResponseRequired()
) {
+                                requestMap.put( command->getCommandId(), command );
+                            }
                         }
+                    } catch( Exception& ex ) {
+                        error.reset( ex.clone() );
+                        break;
                     }
 
                     // Send the message.

Modified: activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransportListener.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransportListener.cpp?rev=755373&r1=755372&r2=755373&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransportListener.cpp
(original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/transport/failover/FailoverTransportListener.cpp
Tue Mar 17 20:00:52 2009
@@ -59,7 +59,11 @@
         Pointer<Command> object;
 
         synchronized( &( parent->requestMap ) ) {
-            object = parent->requestMap.remove( response->getCorrelationId() );
+            try{
+                object = parent->requestMap.remove( response->getCorrelationId() );
+            } catch( NoSuchElementException& ex ) {
+                // Not tracking this request in our map, not an error.
+            }
         }
 
         if( object != NULL ) {



Mime
View raw message