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 2011/11/03 20:53:08 UTC

svn commit: r1197293 - /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp

Author: tabish
Date: Thu Nov  3 19:53:08 2011
New Revision: 1197293

URL: http://svn.apache.org/viewvc?rev=1197293&view=rev
Log:
https://issues.apache.org/jira/browse/AMQCPP-383

Implements the recover method, not tested yet.

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

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp?rev=1197293&r1=1197292&r2=1197293&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQSession.cpp Thu Nov  3 19:53:08 2011
@@ -412,9 +412,20 @@ void ActiveMQSession::recover() {
 
     try{
 
-        throw UnsupportedOperationException(
-            __FILE__, __LINE__,
-            "Recover Method is not yet supported." );
+        checkClosed();
+
+        if (isTransacted()) {
+            throw cms::IllegalStateException("This session is transacted");
+        }
+
+        synchronized( &this->consumers ) {
+            std::vector< ActiveMQConsumer* > consumers = this->consumers.values();
+
+            std::vector< ActiveMQConsumer* >::iterator iter = consumers.begin();
+            for( ; iter != consumers.end(); ++iter ) {
+                (*iter)->rollback();
+            }
+        }
     }
     AMQ_CATCH_ALL_THROW_CMSEXCEPTION()
 }