You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2011/03/14 12:44:14 UTC

svn commit: r1081339 - in /qpid/branches/0.10/qpid/cpp/src/qpid/broker: Broker.cpp Broker.h Queue.cpp ThresholdAlerts.cpp ThresholdAlerts.h

Author: gsim
Date: Mon Mar 14 11:44:14 2011
New Revision: 1081339

URL: http://svn.apache.org/viewvc?rev=1081339&view=rev
Log:
QPID-3136: Merged r1080589 onto release branch

Modified:
    qpid/branches/0.10/qpid/cpp/src/qpid/broker/Broker.cpp
    qpid/branches/0.10/qpid/cpp/src/qpid/broker/Broker.h
    qpid/branches/0.10/qpid/cpp/src/qpid/broker/Queue.cpp
    qpid/branches/0.10/qpid/cpp/src/qpid/broker/ThresholdAlerts.cpp
    qpid/branches/0.10/qpid/cpp/src/qpid/broker/ThresholdAlerts.h

Modified: qpid/branches/0.10/qpid/cpp/src/qpid/broker/Broker.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/0.10/qpid/cpp/src/qpid/broker/Broker.cpp?rev=1081339&r1=1081338&r2=1081339&view=diff
==============================================================================
--- qpid/branches/0.10/qpid/cpp/src/qpid/broker/Broker.cpp (original)
+++ qpid/branches/0.10/qpid/cpp/src/qpid/broker/Broker.cpp Mon Mar 14 11:44:14 2011
@@ -121,7 +121,8 @@ Broker::Options::Options(const std::stri
     qmf2Support(true),
     qmf1Support(true),
     queueFlowStopRatio(80),
-    queueFlowResumeRatio(70)
+    queueFlowResumeRatio(70),
+    queueThresholdEventRatio(80)
 {
     int c = sys::SystemInfo::concurrency();
     workerThreads=c+1;
@@ -156,7 +157,8 @@ Broker::Options::Options(const std::stri
         ("max-session-rate", optValue(maxSessionRate, "MESSAGES/S"), "Sets the maximum message rate per session (0=unlimited)")
         ("async-queue-events", optValue(asyncQueueEvents, "yes|no"), "Set Queue Events async, used for services like replication")
         ("default-flow-stop-threshold", optValue(queueFlowStopRatio, "%MESSAGES"), "Queue capacity level at which flow control is activated.")
-        ("default-flow-resume-threshold", optValue(queueFlowResumeRatio, "%MESSAGES"), "Queue capacity level at which flow control is de-activated.");
+        ("default-flow-resume-threshold", optValue(queueFlowResumeRatio, "%MESSAGES"), "Queue capacity level at which flow control is de-activated.")
+        ("default-event-threshold-ratio", optValue(queueThresholdEventRatio, "%age of limit"), "The ratio of any specified queue limit at which an event will be raised");
 }
 
 const std::string empty;

Modified: qpid/branches/0.10/qpid/cpp/src/qpid/broker/Broker.h
URL: http://svn.apache.org/viewvc/qpid/branches/0.10/qpid/cpp/src/qpid/broker/Broker.h?rev=1081339&r1=1081338&r2=1081339&view=diff
==============================================================================
--- qpid/branches/0.10/qpid/cpp/src/qpid/broker/Broker.h (original)
+++ qpid/branches/0.10/qpid/cpp/src/qpid/broker/Broker.h Mon Mar 14 11:44:14 2011
@@ -120,6 +120,7 @@ public:
         bool qmf1Support;
         uint queueFlowStopRatio;    // producer flow control: on
         uint queueFlowResumeRatio;  // producer flow control: off
+        uint16_t queueThresholdEventRatio;
 
       private:
         std::string getHome();

Modified: qpid/branches/0.10/qpid/cpp/src/qpid/broker/Queue.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/0.10/qpid/cpp/src/qpid/broker/Queue.cpp?rev=1081339&r1=1081338&r2=1081339&view=diff
==============================================================================
--- qpid/branches/0.10/qpid/cpp/src/qpid/broker/Queue.cpp (original)
+++ qpid/branches/0.10/qpid/cpp/src/qpid/broker/Queue.cpp Mon Mar 14 11:44:14 2011
@@ -776,7 +776,7 @@ void Queue::configureImpl(const FieldTab
         setPolicy(QueuePolicy::createQueuePolicy(getName(), _settings));
     }
     if (broker && broker->getManagementAgent()) {
-        ThresholdAlerts::observe(*this, *(broker->getManagementAgent()), _settings);
+        ThresholdAlerts::observe(*this, *(broker->getManagementAgent()), _settings, broker->getOptions().queueThresholdEventRatio);
     }
 
     //set this regardless of owner to allow use of no-local with exclusive consumers also

Modified: qpid/branches/0.10/qpid/cpp/src/qpid/broker/ThresholdAlerts.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/0.10/qpid/cpp/src/qpid/broker/ThresholdAlerts.cpp?rev=1081339&r1=1081338&r2=1081339&view=diff
==============================================================================
--- qpid/branches/0.10/qpid/cpp/src/qpid/broker/ThresholdAlerts.cpp (original)
+++ qpid/branches/0.10/qpid/cpp/src/qpid/broker/ThresholdAlerts.cpp Mon Mar 14 11:44:14 2011
@@ -126,12 +126,12 @@ void ThresholdAlerts::observe(Queue& que
 }
 
 void ThresholdAlerts::observe(Queue& queue, qpid::management::ManagementAgent& agent,
-                              const qpid::framing::FieldTable& settings)
+                              const qpid::framing::FieldTable& settings, uint16_t limitRatio)
 
 {
     qpid::types::Variant::Map map;
     qpid::amqp_0_10::translate(settings, map);
-    observe(queue, agent, map);
+    observe(queue, agent, map, limitRatio);
 }
 
 template <class T>
@@ -169,19 +169,19 @@ class Option
 };
 
 void ThresholdAlerts::observe(Queue& queue, qpid::management::ManagementAgent& agent,
-                              const qpid::types::Variant::Map& settings)
+                              const qpid::types::Variant::Map& settings, uint16_t limitRatio)
 
 {
     //Note: aliases are keys defined by java broker
     Option<int64_t> repeatInterval("qpid.alert_repeat_gap", 60);
     repeatInterval.addAlias("x-qpid-minimum-alert-repeat-gap");
 
-    //If no explicit threshold settings were given use 80% of any
-    //limit from the policy.
+    //If no explicit threshold settings were given use specified
+    //percentage of any limit from the policy.
     const QueuePolicy* policy = queue.getPolicy();
-    Option<uint32_t> countThreshold("qpid.alert_count", (uint32_t) (policy ? policy->getMaxCount()*0.8 : 0));
+    Option<uint32_t> countThreshold("qpid.alert_count", (uint32_t) (policy && limitRatio ? (policy->getMaxCount()*limitRatio/100) : 0));
     countThreshold.addAlias("x-qpid-maximum-message-count");
-    Option<uint64_t> sizeThreshold("qpid.alert_size", (uint64_t) (policy ? policy->getMaxSize()*0.8 : 0));
+    Option<uint64_t> sizeThreshold("qpid.alert_size", (uint64_t) (policy && limitRatio ? (policy->getMaxSize()*limitRatio/100) : 0));
     sizeThreshold.addAlias("x-qpid-maximum-message-size");
 
     observe(queue, agent, countThreshold.get(settings), sizeThreshold.get(settings), repeatInterval.get(settings));

Modified: qpid/branches/0.10/qpid/cpp/src/qpid/broker/ThresholdAlerts.h
URL: http://svn.apache.org/viewvc/qpid/branches/0.10/qpid/cpp/src/qpid/broker/ThresholdAlerts.h?rev=1081339&r1=1081338&r2=1081339&view=diff
==============================================================================
--- qpid/branches/0.10/qpid/cpp/src/qpid/broker/ThresholdAlerts.h (original)
+++ qpid/branches/0.10/qpid/cpp/src/qpid/broker/ThresholdAlerts.h Mon Mar 14 11:44:14 2011
@@ -55,9 +55,9 @@ class ThresholdAlerts : public QueueObse
                         const uint64_t sizeThreshold,
                         const long repeatInterval);
     static void observe(Queue& queue, qpid::management::ManagementAgent& agent,
-                        const qpid::framing::FieldTable& settings);
+                        const qpid::framing::FieldTable& settings, uint16_t limitRatio);
     static void observe(Queue& queue, qpid::management::ManagementAgent& agent,
-                        const qpid::types::Variant::Map& settings);
+                        const qpid::types::Variant::Map& settings, uint16_t limitRatio);
   private:
     const std::string name;
     qpid::management::ManagementAgent& agent;



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