activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r660656 - /activemq/activemq-cpp/trunk/src/examples/main.cpp
Date Tue, 27 May 2008 19:36:42 GMT
Author: tabish
Date: Tue May 27 12:36:40 2008
New Revision: 660656

URL: http://svn.apache.org/viewvc?rev=660656&view=rev
Log:
Fixing some issues with the tests

Modified:
    activemq/activemq-cpp/trunk/src/examples/main.cpp

Modified: activemq/activemq-cpp/trunk/src/examples/main.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/examples/main.cpp?rev=660656&r1=660655&r2=660656&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/examples/main.cpp (original)
+++ activemq/activemq-cpp/trunk/src/examples/main.cpp Tue May 27 12:36:40 2008
@@ -74,6 +74,9 @@
     }
 
     virtual void run() {
+
+        ConnectionFactory* connectionFactory = NULL;
+
         try {
             // Create a ConnectionFactory
             ConnectionFactory* connectionFactory =
@@ -85,6 +88,7 @@
 
             // free the factory, we are done with it.
             delete connectionFactory;
+            connectionFactory = NULL;
 
             // Create a Session
             if( this->sessionTransacted ) {
@@ -123,6 +127,9 @@
             }
 
         }catch ( CMSException& e ) {
+            delete connectionFactory;
+            connectionFactory = NULL;
+
             e.printStackTrace();
         }
     }
@@ -204,15 +211,20 @@
 
     virtual void run() {
 
+        ConnectionFactory* connectionFactory = NULL;
+
         try {
 
             // Create a ConnectionFactory
-            ConnectionFactory* connectionFactory =
+            connectionFactory =
                 ConnectionFactory::createCMSConnectionFactory( brokerURI );
 
             // Create a Connection
             connection = connectionFactory->createConnection();
+
             delete connectionFactory;
+            connectionFactory = NULL;
+
             connection->start();
 
             connection->setExceptionListener(this);
@@ -246,6 +258,13 @@
             doneLatch.await( waitMillis );
 
         } catch (CMSException& e) {
+
+            // Indicate we are ready for messages.
+            latch.countDown();
+
+            delete connectionFactory;
+            connectionFactory = NULL;
+
             e.printStackTrace();
         }
     }



Mime
View raw message