You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ri...@apache.org on 2010/06/03 23:28:42 UTC

svn commit: r951162 - /qpid/trunk/qpid/java/broker-plugins/experimental/slowconsumerdetection/src/main/java/org/apache/qpid/server/virtualhost/plugin/SlowConsumerDetection.java

Author: ritchiem
Date: Thu Jun  3 21:28:41 2010
New Revision: 951162

URL: http://svn.apache.org/viewvc?rev=951162&view=rev
Log:
QPID-1447 : Update SCD for MessageAge when queue is empty at consumer connect. Perhaps additional test requried where queue has old messages but no delete policy, just disconnect. Consumer will be disconnected during the first receive(). Also why is the oldest Arrival time set to Long.MAX_LONG when there are no messages on the queue, why not 0.

Modified:
    qpid/trunk/qpid/java/broker-plugins/experimental/slowconsumerdetection/src/main/java/org/apache/qpid/server/virtualhost/plugin/SlowConsumerDetection.java

Modified: qpid/trunk/qpid/java/broker-plugins/experimental/slowconsumerdetection/src/main/java/org/apache/qpid/server/virtualhost/plugin/SlowConsumerDetection.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/experimental/slowconsumerdetection/src/main/java/org/apache/qpid/server/virtualhost/plugin/SlowConsumerDetection.java?rev=951162&r1=951161&r2=951162&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/experimental/slowconsumerdetection/src/main/java/org/apache/qpid/server/virtualhost/plugin/SlowConsumerDetection.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/experimental/slowconsumerdetection/src/main/java/org/apache/qpid/server/virtualhost/plugin/SlowConsumerDetection.java Thu Jun  3 21:28:41 2010
@@ -117,9 +117,18 @@ class SlowConsumerDetection extends Virt
         if (config != null)
         {
             _logger.info("Retrieved Queue(" + q.getName() + ") Config:" + config);
-            if ((config.getMessageCount() != 0 && q.getMessageCount() >= config.getMessageCount()) ||
-                    (config.getDepth() != 0 && q.getQueueDepth() >= config.getDepth()) ||
-                    (config.getMessageAge() != 0 && q.getOldestMessageArrivalTime() >= config.getMessageAge()))
+
+            int count = q.getMessageCount();
+
+            // First Check message counts
+            if ((config.getMessageCount() != 0 && count >= config.getMessageCount()) ||
+                // The check queue depth
+                (config.getDepth() != 0 && q.getQueueDepth() >= config.getDepth()) ||
+                // finally if we have messages on the queue check Arrival time.
+                // We must check count as OldestArrival time is Long.MAX_LONG when
+                // there are no messages.
+                (config.getMessageAge() != 0 &&
+                 ((count > 0) && q.getOldestMessageArrivalTime() >= config.getMessageAge())))
             {
                 
                 if (_logger.isDebugEnabled())



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org