Return-Path: Delivered-To: apmail-incubator-qpid-commits-archive@locus.apache.org Received: (qmail 61677 invoked from network); 27 Aug 2007 15:25:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Aug 2007 15:25:41 -0000 Received: (qmail 24073 invoked by uid 500); 27 Aug 2007 15:25:37 -0000 Delivered-To: apmail-incubator-qpid-commits-archive@incubator.apache.org Received: (qmail 24034 invoked by uid 500); 27 Aug 2007 15:25:37 -0000 Mailing-List: contact qpid-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: qpid-dev@incubator.apache.org Delivered-To: mailing list qpid-commits@incubator.apache.org Received: (qmail 24025 invoked by uid 99); 27 Aug 2007 15:25:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Aug 2007 08:25:37 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Aug 2007 15:25:40 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 83A261A9832; Mon, 27 Aug 2007 08:25:20 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r570152 - in /incubator/qpid/trunk/qpid/cpp/src/qpid/broker: BrokerChannel.cpp BrokerChannel.h Date: Mon, 27 Aug 2007 15:25:19 -0000 To: qpid-commits@incubator.apache.org From: cctrieloff@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20070827152520.83A261A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: cctrieloff Date: Mon Aug 27 08:25:17 2007 New Revision: 570152 URL: http://svn.apache.org/viewvc?rev=570152&view=rev Log: - cache the exchange on a given Channel Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/BrokerChannel.cpp incubator/qpid/trunk/qpid/cpp/src/qpid/broker/BrokerChannel.h Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/BrokerChannel.cpp URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/BrokerChannel.cpp?rev=570152&r1=570151&r2=570152&view=diff ============================================================================== --- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/BrokerChannel.cpp (original) +++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/BrokerChannel.cpp Mon Aug 27 08:25:17 2007 @@ -335,15 +335,25 @@ } } + + void Channel::route(Message::shared_ptr msg, Deliverable& strategy) { - Exchange::shared_ptr exchange = connection.broker.getExchanges().get(msg->getExchange()); - assert(exchange.get()); - exchange->route(strategy, msg->getRoutingKey(), &(msg->getApplicationHeaders())); + + std::string routeToExchangeName = msg->getExchange(); + // cache the exchange lookup + if (!cacheExchange.get() || cacheExchangeName != routeToExchangeName){ + cacheExchangeName = routeToExchangeName; + cacheExchange = connection.broker.getExchanges().get(routeToExchangeName); + } + + assert(cacheExchange.get()); + cacheExchange->route(strategy, msg->getRoutingKey(), &(msg->getApplicationHeaders())); + if (!strategy.delivered) { //TODO:if reject-unroutable, then reject //else route to alternate exchange - if (exchange->getAlternate()) { - exchange->getAlternate()->route(strategy, msg->getRoutingKey(), &(msg->getApplicationHeaders())); + if (cacheExchange->getAlternate()) { + cacheExchange->getAlternate()->route(strategy, msg->getRoutingKey(), &(msg->getApplicationHeaders())); } } Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/BrokerChannel.h URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/BrokerChannel.h?rev=570152&r1=570151&r2=570152&view=diff ============================================================================== --- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/BrokerChannel.h (original) +++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/BrokerChannel.h Mon Aug 27 08:25:17 2007 @@ -74,6 +74,7 @@ bool blocked; bool windowing; uint32_t msgCredit; + uint32_t byteCredit; public: @@ -116,6 +117,10 @@ MessageBuilder messageBuilder;//builder for in-progress message bool opened; bool flowActive; + + std::string cacheExchangeName; // pair holds last exchange used for routing + Exchange::shared_ptr cacheExchange; + void route(Message::shared_ptr msg, Deliverable& strategy); void complete(Message::shared_ptr msg);// completion handler for MessageBuilder void record(const DeliveryRecord& delivery);