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/07/23 16:27:12 UTC

svn commit: r797081 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core: ActiveMQConnectionSupport.h ActiveMQTransactionContext.cpp ActiveMQTransactionContext.h

Author: tabish
Date: Thu Jul 23 14:27:12 2009
New Revision: 797081

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

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionSupport.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransactionContext.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransactionContext.h

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionSupport.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionSupport.h?rev=797081&r1=797080&r2=797081&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionSupport.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQConnectionSupport.h Thu Jul 23 14:27:12 2009
@@ -105,6 +105,11 @@
          */
         util::LongSequenceGenerator tempDestinationIds;
 
+        /**
+         * Next Local Transaction Id
+         */
+        util::LongSequenceGenerator localTransactionIds;
+
     public:
 
         /**
@@ -305,6 +310,14 @@
         }
 
         /**
+         * Get the Next Temporary Destination Id
+         * @return the next id in the sequence.
+         */
+        long long getNextLocalTransactionId() {
+            return this->localTransactionIds.getNextSequenceId();
+        }
+
+        /**
          * The transport has resumed after an interruption
          */
         virtual void transportResumed() {}

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransactionContext.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransactionContext.cpp?rev=797081&r1=797080&r2=797081&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransactionContext.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransactionContext.cpp Thu Jul 23 14:27:12 2009
@@ -31,7 +31,6 @@
 using namespace activemq::core;
 using namespace activemq::commands;
 using namespace activemq::exceptions;
-using namespace activemq::commands;
 using namespace decaf;
 using namespace decaf::lang;
 using namespace decaf::lang::exceptions;
@@ -99,7 +98,7 @@
             // Create the Id
             Pointer<LocalTransactionId> id( new LocalTransactionId() );
             id->setConnectionId( this->connection->getConnectionInfo().getConnectionId() );
-            id->setValue( this->getNextTransactionId() );
+            id->setValue( this->connection->getNextLocalTransactionId() );
 
             // Create and Populate the Info Command.
             Pointer<TransactionInfo> transactionInfo( new TransactionInfo() );
@@ -229,3 +228,28 @@
         }
     }
 }
+
+////////////////////////////////////////////////////////////////////////////////
+const Pointer<TransactionId>& ActiveMQTransactionContext::getTransactionId() const {
+    if( this->transactionId == NULL ) {
+        throw decaf::lang::exceptions::InvalidStateException(
+            __FILE__, __LINE__, "Transaction Not Started." );
+    }
+
+    return transactionId;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool ActiveMQTransactionContext::isInTransaction() const {
+    return this->transactionId != NULL;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+int ActiveMQTransactionContext::getMaximumRedeliveries() const {
+    return this->maximumRedeliveries;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+long long ActiveMQTransactionContext::getRedeliveryDelay() const {
+    return this->redeliveryDelay;
+}

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransactionContext.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransactionContext.h?rev=797081&r1=797080&r2=797081&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransactionContext.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/ActiveMQTransactionContext.h Thu Jul 23 14:27:12 2009
@@ -52,6 +52,12 @@
      * transaction.maxRedeliveryCount
      *   Max number of times a message can be re-delivered, if the session is
      *   rolled back more than this many time, the message is dropped.
+     *
+     * transaction.redeliveryDelay
+     *   Time in Milliseconds between message redelivery for rolled back
+     *   transactions.
+     *
+     * @since 2.0
      */
     class AMQCPP_API ActiveMQTransactionContext {
     private:
@@ -68,9 +74,6 @@
         // List of Registered Synchronizations
         decaf::util::StlSet< Pointer<Synchronization> > synchronizations;
 
-        // Next available Transaction Id
-        util::LongSequenceGenerator transactionIds;
-
         // Maximum number of time to redeliver a message when a Transaction is
         // rolled back.
         int maximumRedeliveries;
@@ -82,8 +85,11 @@
 
         /**
          * Constructor
-         * @param session - the session that contains this transaction
-         * @param properties - configuration parameters for this object
+         *
+         * @param session
+         *      The session that contains this transaction
+         * @param properties
+         *      Configuration parameters for this object
          */
         ActiveMQTransactionContext( ActiveMQSession* session,
                                     const decaf::util::Properties& properties );
@@ -126,37 +132,30 @@
          * @return TransactionInfo
          * @throw InvalidStateException if a Transaction is not in progress.
          */
-        virtual const decaf::lang::Pointer<commands::TransactionId>& getTransactionId() const {
-            if( this->transactionId == NULL ) {
-                throw decaf::lang::exceptions::InvalidStateException(
-                    __FILE__, __LINE__, "Transaction Not Started." );
-            }
-
-            return transactionId;
-        }
+        virtual const decaf::lang::Pointer<commands::TransactionId>& getTransactionId() const;
 
         /**
          * Checks to see if there is currently a Transaction in progress returns
          * false if not, true otherwise.
+         *
          * @return true if a transaction is in progress.
          */
-        virtual bool isInTransaction() const {
-            return this->transactionId != NULL;
-        }
-
-        int getMaximumRedeliveries() const {
-            return this->maximumRedeliveries;
-        }
-
-        long long getRedeliveryDelay() const {
-            return this->redeliveryDelay;
-        }
+        virtual bool isInTransaction() const;
 
-    private:
+        /**
+         * @returns The Maximum number of time the client will attempt to redeliver a
+         * message from a rolled back transaction before marking the message as not
+         * consumed by this client.
+         */
+        virtual int getMaximumRedeliveries() const;
 
-        long long getNextTransactionId() {
-            return this->transactionIds.getNextSequenceId();
-        }
+        /**
+         * @returns The time in Milliseconds that this client is configured to wait in
+         * between redelivery attempts for a Message in a rolled back transaction.
+         */
+        virtual long long getRedeliveryDelay() const;
+
+    private:
 
         void beforeEnd();
         void afterCommit();