summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorMartin Ritchie <ritchiem@apache.org>2010-06-03 21:28:41 +0000
committerMartin Ritchie <ritchiem@apache.org>2010-06-03 21:28:41 +0000
commit35beeb27000fcf8c21b643a005bb47e87a2fc5b4 (patch)
treeab18bfffe717ead9324d0d08339c549de561acbc /java
parent8d42439d482fe7e90d0e3d2bba92e57a11a2839e (diff)
downloadqpid-python-35beeb27000fcf8c21b643a005bb47e87a2fc5b4.tar.gz
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.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@951162 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
-rw-r--r--java/broker-plugins/experimental/slowconsumerdetection/src/main/java/org/apache/qpid/server/virtualhost/plugin/SlowConsumerDetection.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/java/broker-plugins/experimental/slowconsumerdetection/src/main/java/org/apache/qpid/server/virtualhost/plugin/SlowConsumerDetection.java b/java/broker-plugins/experimental/slowconsumerdetection/src/main/java/org/apache/qpid/server/virtualhost/plugin/SlowConsumerDetection.java
index 73ba91f1e8..71071d4d90 100644
--- a/java/broker-plugins/experimental/slowconsumerdetection/src/main/java/org/apache/qpid/server/virtualhost/plugin/SlowConsumerDetection.java
+++ b/java/broker-plugins/experimental/slowconsumerdetection/src/main/java/org/apache/qpid/server/virtualhost/plugin/SlowConsumerDetection.java
@@ -117,9 +117,18 @@ class SlowConsumerDetection extends VirtualHostHouseKeepingPlugin
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())