diff options
| author | Alan Conway <aconway@apache.org> | 2008-09-22 14:03:07 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2008-09-22 14:03:07 +0000 |
| commit | c0170cdc4e6b08abbe20a4d835941eb645ed351d (patch) | |
| tree | dfe8fa8caec30e3ef799f00b1baa921b0fb2cfc7 /cpp | |
| parent | 03fa9018260242f08d2164f06875fc708fdbf4c7 (diff) | |
| download | qpid-python-c0170cdc4e6b08abbe20a4d835941eb645ed351d.tar.gz | |
Removed redundant code.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@697834 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
| -rw-r--r-- | cpp/src/Makefile.am | 1 | ||||
| -rw-r--r-- | cpp/src/qpid/broker/DeliveryRecord.cpp | 19 | ||||
| -rw-r--r-- | cpp/src/qpid/broker/DeliveryRecord.h | 3 | ||||
| -rw-r--r-- | cpp/src/qpid/broker/Prefetch.h | 42 | ||||
| -rw-r--r-- | cpp/src/qpid/broker/SemanticState.cpp | 15 | ||||
| -rw-r--r-- | cpp/src/qpid/broker/SemanticState.h | 8 |
6 files changed, 1 insertions, 87 deletions
diff --git a/cpp/src/Makefile.am b/cpp/src/Makefile.am index 797c183f2e..52087cbfaa 100644 --- a/cpp/src/Makefile.am +++ b/cpp/src/Makefile.am @@ -462,7 +462,6 @@ nobase_include_HEADERS = \ qpid/broker/PersistableExchange.h \ qpid/broker/PersistableMessage.h \ qpid/broker/PersistableQueue.h \ - qpid/broker/Prefetch.h \ qpid/broker/QueueBindings.h \ qpid/broker/QueuedMessage.h \ qpid/broker/QueuePolicy.h \ diff --git a/cpp/src/qpid/broker/DeliveryRecord.cpp b/cpp/src/qpid/broker/DeliveryRecord.cpp index fb950b8a83..5c74b11a22 100644 --- a/cpp/src/qpid/broker/DeliveryRecord.cpp +++ b/cpp/src/qpid/broker/DeliveryRecord.cpp @@ -161,25 +161,6 @@ uint32_t DeliveryRecord::getCredit() const return credit; } - -void DeliveryRecord::addTo(Prefetch& prefetch) const{ - if(!pull){ - //ignore 'pulled' messages (i.e. those that were sent in - //response to get) when calculating prefetch - prefetch.size += size; - prefetch.count++; - } -} - -void DeliveryRecord::subtractFrom(Prefetch& prefetch) const{ - if(!pull){ - //ignore 'pulled' messages (i.e. those that were sent in - //response to get) when calculating prefetch - prefetch.size -= size; - prefetch.count--; - } -} - void DeliveryRecord::acquire(DeliveryIds& results) { if (queue->acquire(msg)) { acquired = true; diff --git a/cpp/src/qpid/broker/DeliveryRecord.h b/cpp/src/qpid/broker/DeliveryRecord.h index 78dc99e3c6..b5149c5a00 100644 --- a/cpp/src/qpid/broker/DeliveryRecord.h +++ b/cpp/src/qpid/broker/DeliveryRecord.h @@ -31,7 +31,6 @@ #include "DeliveryId.h" #include "DeliveryToken.h" #include "Message.h" -#include "Prefetch.h" namespace qpid { namespace broker { @@ -81,8 +80,6 @@ class DeliveryRecord{ bool isRedundant() const { return ended && completed; } uint32_t getCredit() const; - void addTo(Prefetch&) const; - void subtractFrom(Prefetch&) const; const std::string& getTag() const { return tag; } bool isPull() const { return pull; } friend bool operator<(const DeliveryRecord&, const DeliveryRecord&); diff --git a/cpp/src/qpid/broker/Prefetch.h b/cpp/src/qpid/broker/Prefetch.h deleted file mode 100644 index 8eb27a3e21..0000000000 --- a/cpp/src/qpid/broker/Prefetch.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -#ifndef _Prefetch_ -#define _Prefetch_ - -#include "qpid/framing/amqp_types.h" - -namespace qpid { - namespace broker { - /** - * Count and total size of asynchronously delivered - * (i.e. pushed) messages that have acks outstanding. - */ - struct Prefetch{ - uint32_t size; - uint16_t count; - - void reset() { size = 0; count = 0; } - }; - } -} - - -#endif diff --git a/cpp/src/qpid/broker/SemanticState.cpp b/cpp/src/qpid/broker/SemanticState.cpp index 64bb155c01..3a0bdefcb1 100644 --- a/cpp/src/qpid/broker/SemanticState.cpp +++ b/cpp/src/qpid/broker/SemanticState.cpp @@ -59,13 +59,10 @@ using qpid::ptr_map_ptr; SemanticState::SemanticState(DeliveryAdapter& da, SessionContext& ss) : session(ss), deliveryAdapter(da), - prefetchSize(0), - prefetchCount(0), tagGenerator("sgen"), dtxSelected(false), outputTasks(ss) { - outstanding.reset(); acl = getSession().getBroker().getAcl(); } @@ -231,14 +228,6 @@ void SemanticState::checkDtxTimeout() void SemanticState::record(const DeliveryRecord& delivery) { unacked.push_back(delivery); - delivery.addTo(outstanding); -} - -bool SemanticState::checkPrefetch(intrusive_ptr<Message>& msg) -{ - bool countOk = !prefetchCount || prefetchCount > unacked.size(); - bool sizeOk = !prefetchSize || prefetchSize > msg->contentSize() + outstanding.size || unacked.empty(); - return countOk && sizeOk; } SemanticState::ConsumerImpl::ConsumerImpl(SemanticState* _parent, @@ -290,7 +279,7 @@ bool SemanticState::ConsumerImpl::filter(intrusive_ptr<Message> msg) bool SemanticState::ConsumerImpl::accept(intrusive_ptr<Message> msg) { - blocked = !(filter(msg) && checkCredit(msg) && (!ackExpected || parent->checkPrefetch(msg))); + blocked = !(filter(msg) && checkCredit(msg)); return !blocked; } @@ -402,7 +391,6 @@ void SemanticState::requestDispatch(ConsumerImpl& c) void SemanticState::complete(DeliveryRecord& delivery) { - delivery.subtractFrom(outstanding); ConsumerImplMap::iterator i = consumers.find(delivery.getTag()); if (i != consumers.end()) { i->second->complete(delivery); @@ -423,7 +411,6 @@ void SemanticState::ConsumerImpl::complete(DeliveryRecord& delivery) void SemanticState::recover(bool requeue) { if(requeue){ - outstanding.reset(); //take copy and clear unacked as requeue may result in redelivery to this session //which will in turn result in additions to unacked std::list<DeliveryRecord> copy = unacked; diff --git a/cpp/src/qpid/broker/SemanticState.h b/cpp/src/qpid/broker/SemanticState.h index e2dd4af95b..94bd929adc 100644 --- a/cpp/src/qpid/broker/SemanticState.h +++ b/cpp/src/qpid/broker/SemanticState.h @@ -30,7 +30,6 @@ #include "DtxBuffer.h" #include "DtxManager.h" #include "NameGenerator.h" -#include "Prefetch.h" #include "TxBuffer.h" #include "qpid/framing/FrameHandler.h" @@ -115,9 +114,6 @@ class SemanticState : public sys::OutputTask, SessionContext& session; DeliveryAdapter& deliveryAdapter; ConsumerImplMap consumers; - uint32_t prefetchSize; - uint16_t prefetchCount; - Prefetch outstanding; NameGenerator tagGenerator; std::list<DeliveryRecord> unacked; TxBuffer::shared_ptr txBuffer; @@ -131,7 +127,6 @@ class SemanticState : public sys::OutputTask, void route(boost::intrusive_ptr<Message> msg, Deliverable& strategy); void record(const DeliveryRecord& delivery); - bool checkPrefetch(boost::intrusive_ptr<Message>& msg); void checkDtxTimeout(); ConsumerImpl& find(const std::string& destination); void complete(DeliveryRecord&); @@ -154,9 +149,6 @@ class SemanticState : public sys::OutputTask, */ Queue::shared_ptr getQueue(const std::string& name) const; - uint32_t setPrefetchSize(uint32_t size){ return prefetchSize = size; } - uint16_t setPrefetchCount(uint16_t n){ return prefetchCount = n; } - bool exists(const string& consumerTag); /** |
