qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject svn commit: r1135227 - in /qpid/trunk/qpid/cpp/src/qpid/broker: QueuePolicy.cpp QueuePolicy.h
Date Mon, 13 Jun 2011 19:05:23 GMT
Author: gsim
Date: Mon Jun 13 19:05:23 2011
New Revision: 1135227

URL: http://svn.apache.org/viewvc?rev=1135227&view=rev
Log:
QPID-3140: allow larger queue policy sizes

Modified:
    qpid/trunk/qpid/cpp/src/qpid/broker/QueuePolicy.cpp
    qpid/trunk/qpid/cpp/src/qpid/broker/QueuePolicy.h

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/QueuePolicy.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/QueuePolicy.cpp?rev=1135227&r1=1135226&r2=1135227&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/QueuePolicy.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/QueuePolicy.cpp Mon Jun 13 19:05:23 2011
@@ -117,19 +117,20 @@ void QueuePolicy::update(FieldTable& set
     settings.setString(typeKey, type);
 }
 
-uint32_t QueuePolicy::getCapacity(const FieldTable& settings, const std::string&
key, uint32_t defaultValue)
+template <typename T>
+T getCapacity(const FieldTable& settings, const std::string& key, T defaultValue)
 {
     FieldTable::ValuePtr v = settings.get(key);
 
-    int32_t result = 0;
+    T result = 0;
 
     if (!v) return defaultValue;
     if (v->getType() == 0x23) {
         QPID_LOG(debug, "Value for " << key << " specified as float: " <<
v->get<float>());
     } else if (v->getType() == 0x33) {
         QPID_LOG(debug, "Value for " << key << " specified as double: " <<
v->get<double>());
-    } else if (v->convertsTo<int>()) {
-        result = v->get<int>();
+    } else if (v->convertsTo<T>()) {
+        result = v->get<T>();
         QPID_LOG(debug, "Got integer value for " << key << ": " << result);
         if (result >= 0) return result;
     } else if (v->convertsTo<string>()) {
@@ -319,8 +320,8 @@ std::auto_ptr<QueuePolicy> QueuePolicy::
 
 std::auto_ptr<QueuePolicy> QueuePolicy::createQueuePolicy(const std::string& name,
const qpid::framing::FieldTable& settings)
 {
-    uint32_t maxCount = getCapacity(settings, maxCountKey, 0);
-    uint32_t maxSize = getCapacity(settings, maxSizeKey, defaultMaxSize);
+    uint32_t maxCount = getCapacity<int32_t>(settings, maxCountKey, 0);
+    uint64_t maxSize = getCapacity<int64_t>(settings, maxSizeKey, defaultMaxSize);
     if (maxCount || maxSize) {
         return createQueuePolicy(name, maxCount, maxSize, getType(settings));
     } else {

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/QueuePolicy.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/QueuePolicy.h?rev=1135227&r1=1135226&r2=1135227&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/QueuePolicy.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/QueuePolicy.h Mon Jun 13 19:05:23 2011
@@ -43,8 +43,7 @@ class QueuePolicy
     uint32_t count;
     uint64_t size;
     bool policyExceeded;
-            
-    static uint32_t getCapacity(const qpid::framing::FieldTable& settings, const std::string&
key, uint32_t defaultValue);
+
 
   protected:
     uint64_t getCurrentQueueSize() const { return size; } 



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


Mime
View raw message