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 2015/07/28 22:56:20 UTC

[4/4] activemq-cpp git commit: https://issues.apache.org/jira/browse/AMQCPP-552 https://issues.apache.org/jira/browse/AMQCPP-577

https://issues.apache.org/jira/browse/AMQCPP-552
https://issues.apache.org/jira/browse/AMQCPP-577

Port fixes from Java client to help fix these issues.

Project: http://git-wip-us.apache.org/repos/asf/activemq-cpp/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-cpp/commit/b7e418eb
Tree: http://git-wip-us.apache.org/repos/asf/activemq-cpp/tree/b7e418eb
Diff: http://git-wip-us.apache.org/repos/asf/activemq-cpp/diff/b7e418eb

Branch: refs/heads/master
Commit: b7e418ebeaadc0a4f7b2a8c52146feaf79c0df4b
Parents: 9a4abd6
Author: Timothy Bish <ta...@gmail.com>
Authored: Tue Jul 28 16:52:36 2015 -0400
Committer: Timothy Bish <ta...@gmail.com>
Committed: Tue Jul 28 16:52:36 2015 -0400

----------------------------------------------------------------------
 .../activemq/core/kernels/ActiveMQConsumerKernel.cpp    |  6 +++---
 .../activemq/core/kernels/ActiveMQSessionKernel.cpp     | 12 ++++++------
 2 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/b7e418eb/activemq-cpp/src/main/activemq/core/kernels/ActiveMQConsumerKernel.cpp
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/activemq/core/kernels/ActiveMQConsumerKernel.cpp b/activemq-cpp/src/main/activemq/core/kernels/ActiveMQConsumerKernel.cpp
index 57b9bc2..6723a9d 100644
--- a/activemq-cpp/src/main/activemq/core/kernels/ActiveMQConsumerKernel.cpp
+++ b/activemq-cpp/src/main/activemq/core/kernels/ActiveMQConsumerKernel.cpp
@@ -1028,7 +1028,7 @@ decaf::lang::Pointer<MessageDispatch> ActiveMQConsumerKernel::dequeue(long long
             } else if (internal->redeliveryExceeded(dispatch)) {
                 internal->posionAck(dispatch,
                                     "dispatch to " + getConsumerId()->toString() +
-                                    " exceeds redelivery policy limit: " +
+                                    " exceeds RedeliveryPolicy limit: " +
                                     Integer::toString(internal->redeliveryPolicy->getMaximumRedeliveries()));
             }
 
@@ -1468,7 +1468,6 @@ void ActiveMQConsumerKernel::rollback() {
 
     clearDeliveredList();
     synchronized(this->internal->unconsumedMessages.get()) {
-
         if (this->internal->optimizeAcknowledge) {
             // remove messages read but not acknowledged at the broker yet through optimizeAcknowledge
             if (!this->consumerInfo->isBrowser()) {
@@ -1517,7 +1516,7 @@ void ActiveMQConsumerKernel::rollback() {
                                         this->internal->deliveredMessages.size()));
                 ack->setFirstMessageId(firstMsgId);
                 // TODO - Add cause to the message.
-                std::string message = "Exceeded redelivery policy limit:" +
+                std::string message = "Exceeded RedeliveryPolicy max redelivery limit:" +
                                        Integer::toString(internal->redeliveryPolicy->getMaximumRedeliveries());
                                        //", cause:" + lastMd.getRollbackCause(), lastMd.getRollbackCause()));
                 ack->setPoisonCause(internal->createBrokerError(message));
@@ -1657,6 +1656,7 @@ void ActiveMQConsumerKernel::dispatch(const Pointer<MessageDispatch>& dispatch)
                     }
                 }
             }
+
             if (++internal->dispatchedCount % 1000 == 0) {
                 internal->dispatchedCount = 0;
                 Thread::yield();

http://git-wip-us.apache.org/repos/asf/activemq-cpp/blob/b7e418eb/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp
----------------------------------------------------------------------
diff --git a/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp b/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp
index e6d2760..0329d61 100644
--- a/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp
+++ b/activemq-cpp/src/main/activemq/core/kernels/ActiveMQSessionKernel.cpp
@@ -361,12 +361,6 @@ void ActiveMQSessionKernel::dispose() {
         // Stop the dispatch executor.
         stop();
 
-        // Roll Back the transaction since we were closed without an explicit call
-        // to commit it.
-        if (this->transaction->isInTransaction()) {
-            this->transaction->rollback();
-        }
-
         // Dispose of all Consumers, the dispose method skips the RemoveInfo command.
         this->config->consumerLock.writeLock().lock();
         try {
@@ -413,6 +407,12 @@ void ActiveMQSessionKernel::dispose() {
             this->config->producerLock.writeLock().unlock();
             throw;
         }
+
+        // Roll Back the transaction since we were closed without an explicit call
+        // to commit it.
+        if (this->transaction->isInTransaction()) {
+            this->transaction->rollback();
+        }
     }
     AMQ_CATCH_RETHROW( ActiveMQException )
     AMQ_CATCH_EXCEPTION_CONVERT( Exception, ActiveMQException )