activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r555119 - /activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.cpp
Date Tue, 10 Jul 2007 23:59:36 GMT
Author: tabish
Date: Tue Jul 10 16:59:35 2007
New Revision: 555119

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

Using Set iterator to save time copying and iterating over elements.

Modified:
    activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.cpp

Modified: activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.cpp?view=diff&rev=555119&r1=555118&r2=555119
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/core/ActiveMQSession.cpp Tue Jul 10 16:59:35
2007
@@ -98,19 +98,19 @@
         stop();
 
         // Get the complete list of closeable session resources.
-        std::vector<cms::Closeable*> allResources;
+        // Get the complete list of closeable session resources.
         synchronized( &closableSessionResources ) {
-            allResources = closableSessionResources.toArray();
-        }
 
-        // Close all of the resources.
-        for( unsigned int ix=0; ix<allResources.size(); ++ix ){
-            cms::Closeable* resource = allResources[ix];
-            try{
-                resource->close();
-            } catch( cms::CMSException& ex ){
-                /* Absorb */
+            Iterator<cms::Closeable*>* iter = closableSessionResources.iterator();
+            while( iter->hasNext() ) {
+                cms::Closeable* resource = iter->next();
+                try{
+                    resource->close();
+                } catch( cms::CMSException& ex ){
+                    /* Absorb */
+                }
             }
+            delete iter;
         }
 
         // Destroy the Transaction



Mime
View raw message