diff options
author | Alan Conway <aconway@apache.org> | 2012-09-19 21:42:21 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2012-09-19 21:42:21 +0000 |
commit | f4c9d2900271fa909c59e54b687e2f8848ec87b8 (patch) | |
tree | a956e7c1a0e3f9ba65ff387c59761edce4f5e55c /qpid/cpp/src/qpid/broker/Queue.h | |
parent | 195d6175ef122cb8bd71ff2f6548c2f69820b71c (diff) | |
download | qpid-python-f4c9d2900271fa909c59e54b687e2f8848ec87b8.tar.gz |
QPID-4322: HA sporadic failure in ha_tests
Added Queue::getRange to get range atomically, fixes races around getting
the front and backup of the range as two separate operations.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1387785 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/qpid/broker/Queue.h')
-rw-r--r-- | qpid/cpp/src/qpid/broker/Queue.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/qpid/cpp/src/qpid/broker/Queue.h b/qpid/cpp/src/qpid/broker/Queue.h index 671a24d53e..d52afec6b9 100644 --- a/qpid/cpp/src/qpid/broker/Queue.h +++ b/qpid/cpp/src/qpid/broker/Queue.h @@ -375,9 +375,24 @@ class Queue : public boost::enable_shared_from_this<Queue>, /** *@return sequence number for the back of the queue. The next message pushed - * will be at getPosition+1 + * will be at getPosition()+1 */ QPID_BROKER_EXTERN framing::SequenceNumber getPosition(); + + /** + * Set front and back. + * If the queue is empty then front = back+1 (the first message to + * consume will be the next message pushed.) + * + *@param front = Position of first message to consume. + *@param back = getPosition(), next message pushed will be getPosition()+1 + *@param type Subscription type to use to determine the front. + */ + QPID_BROKER_EXTERN void getRange( + framing::SequenceNumber& front, framing::SequenceNumber& back, + SubscriptionType type=CONSUMER + ); + QPID_BROKER_EXTERN void addObserver(boost::shared_ptr<QueueObserver>); QPID_BROKER_EXTERN void removeObserver(boost::shared_ptr<QueueObserver>); QPID_BROKER_EXTERN void insertSequenceNumbers(const std::string& key); |