qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject svn commit: r1228424 - in /qpid/branches/qpid-3603/qpid/cpp/src: qpid/broker/Consumer.h qpid/broker/FifoDistributor.cpp qpid/broker/MessageGroupManager.cpp qpid/broker/Queue.cpp qpid/cluster/Connection.cpp qpid/cluster/UpdateClient.cpp tests/QueueTest.cpp
Date Fri, 06 Jan 2012 21:54:50 GMT
Author: aconway
Date: Fri Jan  6 21:54:50 2012
New Revision: 1228424

URL: http://svn.apache.org/viewvc?rev=1228424&view=rev
Log:
QPID-3603: Replace public broker::Consumer::position variable with get/set function pair.

Done for the new HA work, but this is better practice in any case.

Modified:
    qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/Consumer.h
    qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/FifoDistributor.cpp
    qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/MessageGroupManager.cpp
    qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/Queue.cpp
    qpid/branches/qpid-3603/qpid/cpp/src/qpid/cluster/Connection.cpp
    qpid/branches/qpid-3603/qpid/cpp/src/qpid/cluster/UpdateClient.cpp
    qpid/branches/qpid-3603/qpid/cpp/src/tests/QueueTest.cpp

Modified: qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/Consumer.h
URL: http://svn.apache.org/viewvc/qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/Consumer.h?rev=1228424&r1=1228423&r2=1228424&view=diff
==============================================================================
--- qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/Consumer.h (original)
+++ qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/Consumer.h Fri Jan  6 21:54:50 2012
@@ -45,20 +45,27 @@ class Consumer {
  public:
     typedef boost::shared_ptr<Consumer> shared_ptr;
 
-    framing::SequenceNumber position;
-
     Consumer(const std::string& _name, bool preAcquires = true)
       : acquires(preAcquires), inListeners(false), name(_name), position(0) {}
+    virtual ~Consumer(){}
+
     bool preAcquires() const { return acquires; }
     const std::string& getName() const { return name; }
 
+    virtual framing::SequenceNumber getPosition() const  { return position; }
+    virtual void setPosition(framing::SequenceNumber pos) { position = pos; }
+
     virtual bool deliver(QueuedMessage& msg) = 0;
     virtual void notify() = 0;
     virtual bool filter(boost::intrusive_ptr<Message>) { return true; }
     virtual bool accept(boost::intrusive_ptr<Message>) { return true; }
     virtual OwnershipToken* getSession() = 0;
     virtual bool isDelayedCompletion() const { return false; }
-    virtual ~Consumer(){}
+
+  protected:
+    framing::SequenceNumber position;
+
+  private:
     friend class QueueListeners;
 };
 

Modified: qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/FifoDistributor.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/FifoDistributor.cpp?rev=1228424&r1=1228423&r2=1228424&view=diff
==============================================================================
--- qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/FifoDistributor.cpp (original)
+++ qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/FifoDistributor.cpp Fri Jan  6 21:54:50
2012
@@ -42,7 +42,7 @@ bool FifoDistributor::allocate(const std
 
 bool FifoDistributor::nextBrowsableMessage( Consumer::shared_ptr& c, QueuedMessage&
next )
 {
-    return messages.browse(c->position, next, false);
+    return messages.browse(c->getPosition(), next, false);
 }
 
 void FifoDistributor::query(qpid::types::Variant::Map&) const

Modified: qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/MessageGroupManager.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/MessageGroupManager.cpp?rev=1228424&r1=1228423&r2=1228424&view=diff
==============================================================================
--- qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/MessageGroupManager.cpp (original)
+++ qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/MessageGroupManager.cpp Fri Jan  6 21:54:50
2012
@@ -207,7 +207,7 @@ bool MessageGroupManager::nextConsumable
     if (!messages.size())
         return false;
 
-    next.position = c->position;
+    next.position = c->getPosition();
     if (!freeGroups.empty()) {
         const framing::SequenceNumber& nextFree = freeGroups.begin()->first;
         if (nextFree < next.position) {     // a free message is older than current
@@ -250,7 +250,7 @@ bool MessageGroupManager::allocate(const
 bool MessageGroupManager::nextBrowsableMessage( Consumer::shared_ptr& c, QueuedMessage&
next )
 {
     // browse: allow access to any available msg, regardless of group ownership (?ok?)
-    return messages.browse(c->position, next, false);
+    return messages.browse(c->getPosition(), next, false);
 }
 
 void MessageGroupManager::query(qpid::types::Variant::Map& status) const

Modified: qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/Queue.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/Queue.cpp?rev=1228424&r1=1228423&r2=1228424&view=diff
==============================================================================
--- qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/Queue.cpp (original)
+++ qpid/branches/qpid-3603/qpid/cpp/src/qpid/broker/Queue.cpp Fri Jan  6 21:54:50 2012
@@ -302,7 +302,7 @@ Queue::ConsumeCode Queue::consumeNextMes
         if (allocator->nextConsumableMessage(c, msg)) {
             if (msg.payload->hasExpired()) {
                 QPID_LOG(debug, "Message expired from queue '" << name << "'");
-                c->position = msg.position;
+                c->setPosition(msg.position);
                 dequeue(0, msg);
                 continue;
             }
@@ -350,7 +350,7 @@ bool Queue::browseNextMessage(QueuedMess
         if (c->filter(msg.payload) && !msg.payload->hasExpired()) {
             if (c->accept(msg.payload)) {
                 //consumer wants the message
-                c->position = msg.position;
+                c->setPosition(msg.position);
                 m = msg;
                 return true;
             } else {
@@ -361,7 +361,7 @@ bool Queue::browseNextMessage(QueuedMess
         } else {
             //consumer will never want this message, continue seeking
             QPID_LOG(debug, "Browser skipping message from '" << name << "'");
-            c->position = msg.position;
+            c->setPosition(msg.position);
         }
     }
     return false;

Modified: qpid/branches/qpid-3603/qpid/cpp/src/qpid/cluster/Connection.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/qpid-3603/qpid/cpp/src/qpid/cluster/Connection.cpp?rev=1228424&r1=1228423&r2=1228424&view=diff
==============================================================================
--- qpid/branches/qpid-3603/qpid/cpp/src/qpid/cluster/Connection.cpp (original)
+++ qpid/branches/qpid-3603/qpid/cpp/src/qpid/cluster/Connection.cpp Fri Jan  6 21:54:50 2012
@@ -407,7 +407,7 @@ void Connection::shadowSetUser(const std
 void Connection::consumerState(const string& name, bool blocked, bool notifyEnabled,
const SequenceNumber& position)
 {
     broker::SemanticState::ConsumerImpl::shared_ptr c = semanticState().find(name);
-    c->position = position;
+    c->setPosition(position);
     c->setBlocked(blocked);
     if (notifyEnabled) c->enableNotify(); else c->disableNotify();
     updateIn.consumerNumbering.add(c);

Modified: qpid/branches/qpid-3603/qpid/cpp/src/qpid/cluster/UpdateClient.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/qpid-3603/qpid/cpp/src/qpid/cluster/UpdateClient.cpp?rev=1228424&r1=1228423&r2=1228424&view=diff
==============================================================================
--- qpid/branches/qpid-3603/qpid/cpp/src/qpid/cluster/UpdateClient.cpp (original)
+++ qpid/branches/qpid-3603/qpid/cpp/src/qpid/cluster/UpdateClient.cpp Fri Jan  6 21:54:50
2012
@@ -542,7 +542,7 @@ void UpdateClient::updateConsumer(
         ci->getTag(),
         ci->isBlocked(),
         ci->isNotifyEnabled(),
-        ci->position
+        ci->getPosition()
     );
     consumerNumbering.add(ci.get());
 

Modified: qpid/branches/qpid-3603/qpid/cpp/src/tests/QueueTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/qpid-3603/qpid/cpp/src/tests/QueueTest.cpp?rev=1228424&r1=1228423&r2=1228424&view=diff
==============================================================================
--- qpid/branches/qpid-3603/qpid/cpp/src/tests/QueueTest.cpp (original)
+++ qpid/branches/qpid-3603/qpid/cpp/src/tests/QueueTest.cpp Fri Jan  6 21:54:50 2012
@@ -300,7 +300,7 @@ QPID_AUTO_TEST_CASE(testSeek){
 
     TestConsumer::shared_ptr consumer(new TestConsumer("test", false));
     SequenceNumber seq(2);
-    consumer->position = seq;
+    consumer->setPosition(seq);
 
     QueuedMessage qm;
     queue->dispatch(consumer);



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


Mime
View raw message