Updated Branches:
  refs/heads/trunk 827667646 -> 272de3a14

https://issues.apache.org/jira/browse/AMQ-4621
some minor tweaks to the slow ack abort strategy, wasn't always kicking
in when it should have.

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

Branch: refs/heads/trunk
Commit: 272de3a146b602abe5f5679c6aca283af2be3d22
Parents: 8276676
Author: Timothy Bish <tabish...@gmai.com>
Authored: Mon Sep 9 17:48:12 2013 -0400
Committer: Timothy Bish <tabish...@gmai.com>
Committed: Mon Sep 9 17:48:12 2013 -0400

----------------------------------------------------------------------
 .../policy/AbortSlowAckConsumerStrategy.java    | 28 +++++++++++++++-----
 1 file changed, 22 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/272de3a1/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/AbortSlowAckConsumerStrategy.java
----------------------------------------------------------------------
diff --git 
a/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/AbortSlowAckConsumerStrategy.java
 
b/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/AbortSlowAckConsumerStrategy.java
index 73e8efe..fe49392 100644
--- 
a/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/AbortSlowAckConsumerStrategy.java
+++ 
b/activemq-broker/src/main/java/org/apache/activemq/broker/region/policy/AbortSlowAckConsumerStrategy.java
@@ -107,6 +107,10 @@ public class AbortSlowAckConsumerStrategy extends 
AbortSlowConsumerStrategy {
                 // Not considered Idle so ensure its cleared from the list
                 if (slowConsumers.remove(subscriber) != null) {
                     LOG.info("sub: {} is no longer slow", 
subscriber.getConsumerInfo().getConsumerId());
+                } else {
+                    if (LOG.isTraceEnabled()) {
+                        LOG.trace("Not ignoring idle Consumer {}", 
subscriber.getConsumerInfo().getConsumerId());
+                    }
                 }
             }
 
@@ -133,13 +137,25 @@ public class AbortSlowAckConsumerStrategy extends 
AbortSlowConsumerStrategy {
     private void abortAllQualifiedSlowConsumers() {
         HashMap<Subscription, SlowConsumerEntry> toAbort = new 
HashMap<Subscription, SlowConsumerEntry>();
         for (Entry<Subscription, SlowConsumerEntry> entry : 
slowConsumers.entrySet()) {
-            if (entry.getKey().isSlowConsumer()) {
-                if (getMaxSlowDuration() > 0 &&
-                    (entry.getValue().markCount * getCheckPeriod() > 
getMaxSlowDuration()) ||
-                    getMaxSlowCount() > 0 && entry.getValue().slowCount > 
getMaxSlowCount()) {
+            if (getMaxSlowDuration() > 0 &&
+                (entry.getValue().markCount * getCheckPeriod() > 
getMaxSlowDuration()) ||
+                getMaxSlowCount() > 0 && entry.getValue().slowCount > 
getMaxSlowCount()) {
+
+                if (LOG.isTraceEnabled()) {
+                    LOG.trace("Remove consumer {} from slow list: " +
+                              "slow duration = " + entry.getValue().markCount 
* getCheckPeriod() + ", " +
+                              "slow count = " + entry.getValue().slowCount,
+                              
entry.getKey().getConsumerInfo().getConsumerId());
+                }
 
-                    toAbort.put(entry.getKey(), entry.getValue());
-                    slowConsumers.remove(entry.getKey());
+                toAbort.put(entry.getKey(), entry.getValue());
+                slowConsumers.remove(entry.getKey());
+            } else {
+                if (LOG.isTraceEnabled()) {
+                    LOG.trace("Not yet time to abot consumer {}: " +
+                              "slow duration = " + entry.getValue().markCount 
* getCheckPeriod() + ", " +
+                              "slow count = " + entry.getValue().slowCount,
+                              
entry.getKey().getConsumerInfo().getConsumerId());
                 }
             }
         }

Reply via email to