summaryrefslogtreecommitdiff
path: root/qpid/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
commit224dad6d3e081f00253a30d808c7c262af533919 (patch)
treed34d18cd7945962a7083b41b6a0298fcefa79366 /qpid/java
parent11200701e95cc625ad4761048e73c6208d127e89 (diff)
downloadqpid-python-224dad6d3e081f00253a30d808c7c262af533919.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@951162 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
-rw-r--r--qpid/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/qpid/java/broker-plugins/experimental/slowconsumerdetection/src/main/java/org/apache/qpid/server/virtualhost/plugin/SlowConsumerDetection.java b/qpid/java/broker-plugins/experimental/slowconsumerdetection/src/main/java/org/apache/qpid/server/virtualhost/plugin/SlowConsumerDetection.java
index 73ba91f1e8..71071d4d90 100644
--- a/qpid/java/broker-plugins/experimental/slowconsumerdetection/src/main/java/org/apache/qpid/server/virtualhost/plugin/SlowConsumerDetection.java
+++ b/qpid/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())