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/06/15 17:45:01 UTC

svn commit: r784825 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq: state/ConnectionStateTracker.cpp transport/failover/FailoverTransport.cpp

Author: tabish
Date: Mon Jun 15 15:45:00 2009
New Revision: 784825

URL: http://svn.apache.org/viewvc?rev=784825&view=rev
Log:
Fix for: https://issues.apache.org/activemq/browse/AMQCPP-247

Error in the ConnectionStateTracker when beginning a new transaction.

Added some code to FailoverTransport to better mark the exceptions when caught so there is a more detailed stack trace generated.

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

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/state/ConnectionStateTracker.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/state/ConnectionStateTracker.cpp?rev=784825&r1=784824&r2=784825&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/state/ConnectionStateTracker.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/state/ConnectionStateTracker.cpp Mon Jun 15 15:45:00 2009
@@ -569,12 +569,11 @@
             if( connectionId != NULL ) {
                 Pointer<ConnectionState> cs = connectionStates.get( connectionId );
                 if( cs != NULL ) {
+                    cs->addTransactionState( info->getTransactionId() );
                     Pointer<TransactionState> transactionState =
                         cs->getTransactionState( info->getTransactionId() );
-                    if( transactionState != NULL ) {
-                        transactionState->addCommand(
-                            Pointer<Command>( info->cloneDataStructure() ) );
-                    }
+                    transactionState->addCommand(
+                        Pointer<Command>( info->cloneDataStructure() ) );
                 }
             }
 

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=784825&r1=784824&r2=784825&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 Mon Jun 15 15:45:00 2009
@@ -158,7 +158,7 @@
         return this->transportListener;
     }
 
-	return NULL;
+    return NULL;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -250,6 +250,7 @@
                             }
                         }
                     } catch( Exception& ex ) {
+                        ex.setMark( __FILE__, __LINE__ );
                         error.reset( ex.clone() );
                         break;
                     }
@@ -260,6 +261,8 @@
                         stateTracker.trackBack( command );
                     } catch( IOException& e ) {
 
+                        e.setMark( __FILE__, __LINE__ );
+
                         // If the command was not tracked.. we will retry in
                         // this method
                         if( tracked == NULL ) {
@@ -278,6 +281,7 @@
 
                     return;
                 } catch( IOException& e ) {
+                    e.setMark( __FILE__, __LINE__ );
                     handleTransportFailure( e );
                 }
             }
@@ -520,6 +524,9 @@
 
                 try {
 
+                    std::cout << "FailoverTransport: Attempting Connection to "
+                              << uri.toString() << std::endl;
+
                     transport = createTransport( uri );
                     transport->setTransportListener( myTransportListener.get() );
                     transport->start();
@@ -529,6 +536,7 @@
                     }
 
                 } catch( Exception& e ) {
+                    e.setMark( __FILE__, __LINE__ );
                     transport.reset( NULL );
                     failures.add( uri );
                     failure.reset( e.clone() );