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<MessageDispatch>& 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<MessageDispatch>& message ) {
synchronized( &mutex ) {
- this->getChannel( message ).enqueueFront( message );
+ this->getChannel( message ).addFirst( message );
this->enqueued++;
mutex.notify();
}
@@ -170,7 +170,7 @@ std::vector< Pointer<MessageDispatch> >
for( int i = MAX_PRIORITIES - 1; i >= 0; --i ) {
std::vector< Pointer<MessageDispatch> > 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<MessageDispatch> >
}
////////////////////////////////////////////////////////////////////////////////
-StlQueue< Pointer<MessageDispatch> >&
SimplePriorityMessageDispatchChannel::getChannel( const
Pointer<MessageDispatch>& dispatch ) {
+LinkedList< Pointer<MessageDispatch> >&
SimplePriorityMessageDispatchChannel::getChannel( const
Pointer<MessageDispatch>& dispatch ) {
int priority = cms::Message::DEFAULT_MSG_PRIORITY;
@@ -196,8 +196,8 @@ Pointer<MessageDispatch> SimplePriorityM
if( this->enqueued > 0 ) {
for( int i = MAX_PRIORITIES - 1; i >= 0; i-- ) {
- StlQueue< Pointer<MessageDispatch> >& channel = channels[i];
- if( !channel.empty() ) {
+ LinkedList< Pointer<MessageDispatch> >& channel = channels[i];
+ if( !channel.isEmpty() ) {
this->enqueued--;
return channel.pop();
}
@@ -212,9 +212,9 @@ Pointer<MessageDispatch> SimplePriorityM
if( this->enqueued > 0 ) {
for( int i = MAX_PRIORITIES - 1; i >= 0; i-- ) {
- StlQueue< Pointer<MessageDispatch> >& channel = channels[i];
- if( !channel.empty() ) {
- return channel.front();
+ LinkedList< Pointer<MessageDispatch> >& 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 <activemq/util/Config.h>
#include <activemq/core/MessageDispatchChannel.h>
-#include <decaf/util/StlQueue.h>
+#include <decaf/util/LinkedList.h>
#include <decaf/lang/ArrayPointer.h>
#include <decaf/util/concurrent/Mutex.h>
@@ -40,7 +40,7 @@ namespace core {
mutable decaf::util::concurrent::Mutex mutex;
- mutable ArrayPointer< decaf::util::StlQueue< Pointer<MessageDispatch>
> > channels;
+ mutable ArrayPointer< decaf::util::LinkedList<
Pointer<MessageDispatch> > > channels;
int enqueued;
@@ -138,7 +138,7 @@ namespace core {
private:
- decaf::util::StlQueue< Pointer<MessageDispatch> >& getChannel( const
Pointer<MessageDispatch>& dispatch );
+ decaf::util::LinkedList< Pointer<MessageDispatch> >& getChannel( const
Pointer<MessageDispatch>& dispatch );
Pointer<MessageDispatch> removeFirst();