diff options
| author | Alan Conway <aconway@apache.org> | 2012-01-18 22:08:53 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2012-01-18 22:08:53 +0000 |
| commit | cda5c3aca6816f2bc6ec6ed5aeefd660916e4d83 (patch) | |
| tree | af4e3e3d2d283a5fdad4976236ead3190a8a6afe /qpid | |
| parent | e42d55f87498266ee5b25dbe53bf3286dc0b11af (diff) | |
| download | qpid-python-cda5c3aca6816f2bc6ec6ed5aeefd660916e4d83.tar.gz | |
QPID-3603: Merge SemanticState unsubscribe with cancel.
Simplyfig the code, there is no need for these to be separate functions.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1233087 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid')
| -rw-r--r-- | qpid/cpp/src/qpid/broker/Consumer.h | 1 | ||||
| -rw-r--r-- | qpid/cpp/src/qpid/broker/SemanticState.cpp | 13 | ||||
| -rw-r--r-- | qpid/cpp/src/qpid/broker/SemanticState.h | 2 | ||||
| -rw-r--r-- | qpid/cpp/src/tests/QueueTest.cpp | 1 |
4 files changed, 8 insertions, 9 deletions
diff --git a/qpid/cpp/src/qpid/broker/Consumer.h b/qpid/cpp/src/qpid/broker/Consumer.h index 74052844c9..647f082e44 100644 --- a/qpid/cpp/src/qpid/broker/Consumer.h +++ b/qpid/cpp/src/qpid/broker/Consumer.h @@ -57,6 +57,7 @@ class Consumer { virtual bool filter(boost::intrusive_ptr<Message>) { return true; } virtual bool accept(boost::intrusive_ptr<Message>) { return true; } virtual OwnershipToken* getSession() = 0; + virtual void cancel() = 0; protected: framing::SequenceNumber position; diff --git a/qpid/cpp/src/qpid/broker/SemanticState.cpp b/qpid/cpp/src/qpid/broker/SemanticState.cpp index 0956501e76..2b9fd247f5 100644 --- a/qpid/cpp/src/qpid/broker/SemanticState.cpp +++ b/qpid/cpp/src/qpid/broker/SemanticState.cpp @@ -93,7 +93,7 @@ void SemanticState::closed() { //now unsubscribe, which may trigger queue deletion and thus //needs to occur after the requeueing of unacked messages for (ConsumerImplMap::iterator i = consumers.begin(); i != consumers.end(); i++) { - unsubscribe(i->second); + cancel(i->second); } closeComplete = true; } @@ -408,8 +408,10 @@ void SemanticState::disable(ConsumerImpl::shared_ptr c) session.getConnection().outputTasks.removeOutputTask(c.get()); } -void SemanticState::unsubscribe(ConsumerImpl::shared_ptr c) + +void SemanticState::cancel(ConsumerImpl::shared_ptr c) { + disable(c); Queue::shared_ptr queue = c->getQueue(); if(queue) { queue->cancel(c); @@ -417,12 +419,7 @@ void SemanticState::unsubscribe(ConsumerImpl::shared_ptr c) Queue::tryAutoDelete(session.getBroker(), queue); } } -} - -void SemanticState::cancel(ConsumerImpl::shared_ptr c) -{ - disable(c); - unsubscribe(c); + c->cancel(); } void SemanticState::handle(intrusive_ptr<Message> msg) { diff --git a/qpid/cpp/src/qpid/broker/SemanticState.h b/qpid/cpp/src/qpid/broker/SemanticState.h index c08aaba07e..26fd815424 100644 --- a/qpid/cpp/src/qpid/broker/SemanticState.h +++ b/qpid/cpp/src/qpid/broker/SemanticState.h @@ -108,6 +108,7 @@ class SemanticState : private boost::noncopyable { bool deliver(QueuedMessage& msg); bool filter(boost::intrusive_ptr<Message> msg); bool accept(boost::intrusive_ptr<Message> msg); + void cancel() {} void disableNotify(); void enableNotify(); @@ -173,7 +174,6 @@ class SemanticState : private boost::noncopyable { AckRange findRange(DeliveryId first, DeliveryId last); void requestDispatch(); void cancel(ConsumerImpl::shared_ptr); - void unsubscribe(ConsumerImpl::shared_ptr); void disable(ConsumerImpl::shared_ptr); public: diff --git a/qpid/cpp/src/tests/QueueTest.cpp b/qpid/cpp/src/tests/QueueTest.cpp index ccdb7810e1..0b1b4cc59e 100644 --- a/qpid/cpp/src/tests/QueueTest.cpp +++ b/qpid/cpp/src/tests/QueueTest.cpp @@ -66,6 +66,7 @@ public: return true; }; void notify() {} + void cancel() {} OwnershipToken* getSession() { return 0; } }; |
