Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 29214 invoked from network); 17 Dec 2010 20:08:21 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 17 Dec 2010 20:08:21 -0000 Received: (qmail 57919 invoked by uid 500); 17 Dec 2010 20:08:21 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 57887 invoked by uid 500); 17 Dec 2010 20:08:21 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 57880 invoked by uid 99); 17 Dec 2010 20:08:21 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Dec 2010 20:08:21 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Dec 2010 20:08:19 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id D9CE523888A6; Fri, 17 Dec 2010 20:07:57 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1050483 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core: SimplePriorityMessageDispatchChannel.cpp SimplePriorityMessageDispatchChannel.h Date: Fri, 17 Dec 2010 20:07:57 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101217200757.D9CE523888A6@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tabish Date: Fri Dec 17 20:07:57 2010 New Revision: 1050483 URL: http://svn.apache.org/viewvc?rev=1050483&view=rev Log: Switch to using the new LinkedList class as its faster and better tested. Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/SimplePriorityMessageDispatchChannel.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/SimplePriorityMessageDispatchChannel.h Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/SimplePriorityMessageDispatchChannel.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/SimplePriorityMessageDispatchChannel.cpp?rev=1050483&r1=1050482&r2=1050483&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/SimplePriorityMessageDispatchChannel.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/SimplePriorityMessageDispatchChannel.cpp Fri Dec 17 20:07:57 2010 @@ -47,7 +47,7 @@ SimplePriorityMessageDispatchChannel::~S //////////////////////////////////////////////////////////////////////////////// void SimplePriorityMessageDispatchChannel::enqueue( const Pointer& message ) { synchronized( &mutex ) { - this->getChannel( message ).push( message ); + this->getChannel( message ).addLast( message ); this->enqueued++; mutex.notify(); } @@ -56,7 +56,7 @@ void SimplePriorityMessageDispatchChanne //////////////////////////////////////////////////////////////////////////////// void SimplePriorityMessageDispatchChannel::enqueueFirst( const Pointer& message ) { synchronized( &mutex ) { - this->getChannel( message ).enqueueFront( message ); + this->getChannel( message ).addFirst( message ); this->enqueued++; mutex.notify(); } @@ -170,7 +170,7 @@ std::vector< Pointer > for( int i = MAX_PRIORITIES - 1; i >= 0; --i ) { std::vector< Pointer > temp( channels[i].toArray() ); result.insert( result.end(), temp.begin(), temp.end() ); - this->enqueued -= temp.size(); + this->enqueued -= (int)temp.size(); channels[i].clear(); } } @@ -179,7 +179,7 @@ std::vector< Pointer > } //////////////////////////////////////////////////////////////////////////////// -StlQueue< Pointer >& SimplePriorityMessageDispatchChannel::getChannel( const Pointer& dispatch ) { +LinkedList< Pointer >& SimplePriorityMessageDispatchChannel::getChannel( const Pointer& dispatch ) { int priority = cms::Message::DEFAULT_MSG_PRIORITY; @@ -196,8 +196,8 @@ Pointer SimplePriorityM if( this->enqueued > 0 ) { for( int i = MAX_PRIORITIES - 1; i >= 0; i-- ) { - StlQueue< Pointer >& channel = channels[i]; - if( !channel.empty() ) { + LinkedList< Pointer >& channel = channels[i]; + if( !channel.isEmpty() ) { this->enqueued--; return channel.pop(); } @@ -212,9 +212,9 @@ Pointer SimplePriorityM if( this->enqueued > 0 ) { for( int i = MAX_PRIORITIES - 1; i >= 0; i-- ) { - StlQueue< Pointer >& channel = channels[i]; - if( !channel.empty() ) { - return channel.front(); + LinkedList< Pointer >& channel = channels[i]; + if( !channel.isEmpty() ) { + return channel.getFirst(); } } } Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/SimplePriorityMessageDispatchChannel.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/SimplePriorityMessageDispatchChannel.h?rev=1050483&r1=1050482&r2=1050483&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/SimplePriorityMessageDispatchChannel.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/core/SimplePriorityMessageDispatchChannel.h Fri Dec 17 20:07:57 2010 @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include @@ -40,7 +40,7 @@ namespace core { mutable decaf::util::concurrent::Mutex mutex; - mutable ArrayPointer< decaf::util::StlQueue< Pointer > > channels; + mutable ArrayPointer< decaf::util::LinkedList< Pointer > > channels; int enqueued; @@ -138,7 +138,7 @@ namespace core { private: - decaf::util::StlQueue< Pointer >& getChannel( const Pointer& dispatch ); + decaf::util::LinkedList< Pointer >& getChannel( const Pointer& dispatch ); Pointer removeFirst();