summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/client/LocalQueue.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-07-01 18:01:11 +0000
committerAlan Conway <aconway@apache.org>2008-07-01 18:01:11 +0000
commitb010894ebe6c468fef0c14ad869b80ef336ab11f (patch)
tree87fd021e862ad21abffc9457711f066651e67418 /cpp/src/qpid/client/LocalQueue.cpp
parent4db79de7e806ceba3a243abef9847f15fc41cc40 (diff)
downloadqpid-python-b010894ebe6c468fef0c14ad869b80ef336ab11f.tar.gz
Added timeout to SubscriptionManager::get(), LocalQueue::get() and BlockingQueue::get()
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@673158 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client/LocalQueue.cpp')
-rw-r--r--cpp/src/qpid/client/LocalQueue.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/cpp/src/qpid/client/LocalQueue.cpp b/cpp/src/qpid/client/LocalQueue.cpp
index 04cee40a37..99ab6f0133 100644
--- a/cpp/src/qpid/client/LocalQueue.cpp
+++ b/cpp/src/qpid/client/LocalQueue.cpp
@@ -31,14 +31,25 @@ using namespace framing;
LocalQueue::LocalQueue(AckPolicy a) : autoAck(a) {}
LocalQueue::~LocalQueue() {}
-Message LocalQueue::pop() {
+Message LocalQueue::pop() { return get(); }
+
+Message LocalQueue::get() {
+ Message result;
+ bool ok = get(result, sys::TIME_INFINITE);
+ assert(ok); (void) ok;
+ return result;
+}
+
+bool LocalQueue::get(Message& result, sys::Duration timeout) {
if (!queue)
throw ClosedException();
- FrameSet::shared_ptr content = queue->pop();
+ FrameSet::shared_ptr content;
+ bool ok = queue->pop(content, timeout);
+ if (!ok) return false;
if (content->isA<MessageTransferBody>()) {
- Message m(*content);
- autoAck.ack(m, session);
- return m;
+ result = Message(*content);
+ autoAck.ack(result, session);
+ return true;
}
else
throw CommandInvalidException(