From 758a24c3b01035f7398d01c88acac1766e660dd7 Mon Sep 17 00:00:00 2001 From: "Carl C. Trieloff" Date: Tue, 30 Sep 2008 16:04:29 +0000 Subject: QPID-1306 Cleaner consume check, pointed out by gsim. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@700516 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/broker/Queue.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'cpp/src/qpid') diff --git a/cpp/src/qpid/broker/Queue.cpp b/cpp/src/qpid/broker/Queue.cpp index d50e887df4..735a116cf2 100644 --- a/cpp/src/qpid/broker/Queue.cpp +++ b/cpp/src/qpid/broker/Queue.cpp @@ -244,7 +244,7 @@ bool Queue::consumeNextMessage(QueuedMessage& m, Consumer::shared_ptr c) return false; } else { QueuedMessage msg = messages.front(); - if (store && !msg.payload->isEnqueueComplete()) { + if (!optimisticConsume && store && !msg.payload->isEnqueueComplete()) { QPID_LOG(debug, "Messages not ready to dispatch on queue '" << name << "'"); addListener(c); return false; @@ -482,11 +482,7 @@ bool Queue::enqueue(TransactionContext* ctxt, boost::intrusive_ptr msg) } if (msg->isPersistent() && store) { - if (optimisticConsume){ - msg->enqueueComplete(); // (optimistic) allow consume before written to disk - } else { - msg->enqueueAsync(shared_from_this(), store); //increment to async counter -- for message sent to more than one queue - } + msg->enqueueAsync(shared_from_this(), store); //increment to async counter -- for message sent to more than one queue boost::intrusive_ptr pmsg = boost::static_pointer_cast(msg); store->enqueue(ctxt, pmsg, *this); return true; @@ -503,11 +499,7 @@ bool Queue::dequeue(TransactionContext* ctxt, const QueuedMessage& msg) dequeued(msg); } if (msg.payload->isPersistent() && store) { - if (optimisticConsume) { - msg.payload->dequeueComplete(); - } else { - msg.payload->dequeueAsync(shared_from_this(), store); //increment to async counter -- for message sent to more than one queue - } + msg.payload->dequeueAsync(shared_from_this(), store); //increment to async counter -- for message sent to more than one queue boost::intrusive_ptr pmsg = boost::static_pointer_cast(msg.payload); store->dequeue(ctxt, pmsg, *this); return true; -- cgit v1.2.1