activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r501852 - /incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp
Date Wed, 31 Jan 2007 14:25:21 GMT
Author: tabish
Date: Wed Jan 31 06:25:20 2007
New Revision: 501852

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

Update Session to clone sent messages and destroy the clones once the message is sent.  This
is to allow the user to delete their message pointers after a send.  We may want to change
to CMS API at some point so that we control object lifetime after a send.

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

Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp?view=diff&rev=501852&r1=501851&r2=501852
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp
(original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp
Wed Jan 31 06:25:20 2007
@@ -572,9 +572,11 @@
 
         if( useAsyncSend == true ) {
 
-            // Put it in the send queue, thread will dispatch it.
+            // Put it in the send queue, thread will dispatch it.  We clone it
+            // in case the client deletes their copy before we get a chance to
+            // send it.
             synchronized( &msgQueue ) {
-                msgQueue.push( make_pair( message, producer ) );
+                msgQueue.push( make_pair( message->clone(), producer ) );
                 msgQueue.notifyAll();
             }
 
@@ -686,6 +688,8 @@
                     messagePair.first, 
                     messagePair.second->getProducerInfo() );
 
+            // Destroy Our copy of the message
+            delete messagePair.first;
         }
     }
     catch(...)



Mime
View raw message