summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/broker/QueueFlowLimit.cpp
diff options
context:
space:
mode:
authorKen Giusti <kgiusti@apache.org>2011-05-03 22:04:51 +0000
committerKen Giusti <kgiusti@apache.org>2011-05-03 22:04:51 +0000
commitd7cf0860fe89d313517ba648bd7ef87d75ac6ec6 (patch)
tree5439d9b85015d88069aa9ab917a3bd4f8554ad19 /cpp/src/qpid/broker/QueueFlowLimit.cpp
parent5ed44e66c5fab9a64159e562b8605cbd2da62f24 (diff)
downloadqpid-python-d7cf0860fe89d313517ba648bd7ef87d75ac6ec6.tar.gz
QPID-3243: correctly use --max-queue-count value to compute flow limit.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1099278 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/QueueFlowLimit.cpp')
-rw-r--r--cpp/src/qpid/broker/QueueFlowLimit.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/cpp/src/qpid/broker/QueueFlowLimit.cpp b/cpp/src/qpid/broker/QueueFlowLimit.cpp
index 5abd7fe666..9f1d3b65f8 100644
--- a/cpp/src/qpid/broker/QueueFlowLimit.cpp
+++ b/cpp/src/qpid/broker/QueueFlowLimit.cpp
@@ -282,7 +282,9 @@ QueueFlowLimit *QueueFlowLimit::createLimit(Queue *queue, const qpid::framing::F
return 0;
}
- if (settings.get(flowStopCountKey) || settings.get(flowStopSizeKey)) {
+ if (settings.get(flowStopCountKey) || settings.get(flowStopSizeKey) ||
+ settings.get(flowResumeCountKey) || settings.get(flowResumeSizeKey)) {
+ // user provided (some) flow settings manually...
uint32_t flowStopCount = getCapacity(settings, flowStopCountKey, 0);
uint32_t flowResumeCount = getCapacity(settings, flowResumeCountKey, 0);
uint64_t flowStopSize = getCapacity(settings, flowStopSizeKey, 0);
@@ -293,11 +295,15 @@ QueueFlowLimit *QueueFlowLimit::createLimit(Queue *queue, const qpid::framing::F
return new QueueFlowLimit(queue, flowStopCount, flowResumeCount, flowStopSize, flowResumeSize);
}
- if (defaultFlowStopRatio) {
+ if (defaultFlowStopRatio) { // broker has a default ratio setup...
uint64_t maxByteCount = getCapacity(settings, QueuePolicy::maxSizeKey, defaultMaxSize);
uint64_t flowStopSize = (uint64_t)(maxByteCount * (defaultFlowStopRatio/100.0) + 0.5);
uint64_t flowResumeSize = (uint64_t)(maxByteCount * (defaultFlowResumeRatio/100.0));
- return new QueueFlowLimit(queue, 0, 0, flowStopSize, flowResumeSize);
+ uint32_t maxMsgCount = getCapacity(settings, QueuePolicy::maxCountKey, 0); // no size by default
+ uint32_t flowStopCount = (uint32_t)(maxMsgCount * (defaultFlowStopRatio/100.0) + 0.5);
+ uint32_t flowResumeCount = (uint32_t)(maxMsgCount * (defaultFlowResumeRatio/100.0));
+
+ return new QueueFlowLimit(queue, flowStopCount, flowResumeCount, flowStopSize, flowResumeSize);
}
return 0;
}