diff options
| author | Alan Conway <aconway@apache.org> | 2007-10-29 21:14:44 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2007-10-29 21:14:44 +0000 |
| commit | da6e2b9f62966ef7d0cb69f58ffe1365af98d676 (patch) | |
| tree | a46b84d820f2c26f6094f092e18a0937deb46ecf /cpp/src/tests/InProcessBroker.h | |
| parent | 505c43651b302ecf773bff1fcf3d45f5a1aef682 (diff) | |
| download | qpid-python-da6e2b9f62966ef7d0cb69f58ffe1365af98d676.tar.gz | |
client/BlockingQueue.h, sys/ConcurrentQueue.h: merged to sys/BlockingQueue.h
- updated all users
qpid/Exception.h: Removed unimplemented clone() function.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@589857 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/InProcessBroker.h')
| -rw-r--r-- | cpp/src/tests/InProcessBroker.h | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/cpp/src/tests/InProcessBroker.h b/cpp/src/tests/InProcessBroker.h index c5860568db..3f6ff0936e 100644 --- a/cpp/src/tests/InProcessBroker.h +++ b/cpp/src/tests/InProcessBroker.h @@ -26,7 +26,7 @@ #include "qpid/client/Connection.h" #include "qpid/log/Statement.h" #include "qpid/sys/Thread.h" -#include "qpid/sys/ConcurrentQueue.h" +#include "qpid/sys/BlockingQueue.h" #include "qpid/shared_ptr.h" #include <vector> @@ -65,26 +65,29 @@ class InProcessConnector : } ~NetworkQueue() { - queue.shutdown(); + queue.close(); thread.join(); } void push(AMQFrame& f) { queue.push(f); } void run() { - AMQFrame f; - while (queue.waitPop(f)) { - Lock l(lock); - if (inputHandler) { - QPID_LOG(debug, QPID_MSG(receiver << " RECV: " << f)); - inputHandler->handle(f); - } - else { - QPID_LOG(debug, QPID_MSG(receiver << " DROP: " << f)); + try { + while(true) { + AMQFrame f = queue.pop(); + if (inputHandler) { + QPID_LOG(debug, QPID_MSG(receiver << " RECV: " << f)); + inputHandler->handle(f); + } + else + QPID_LOG(debug, QPID_MSG(receiver << " DROP: " << f)); } } + catch (const sys::QueueClosed&) { + return; + } } - + void setInputHandler(FrameHandler* h) { Lock l(lock); inputHandler = h; @@ -92,7 +95,7 @@ class InProcessConnector : private: sys::Mutex lock; - sys::ConcurrentQueue<AMQFrame> queue; + sys::BlockingQueue<AMQFrame> queue; sys::Thread thread; FrameHandler* inputHandler; const char* const receiver; |
