diff options
author | Alan Conway <aconway@apache.org> | 2008-06-12 19:19:22 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2008-06-12 19:19:22 +0000 |
commit | c3c98db893d6e127dc5e0037fb2c3548e8f90a5a (patch) | |
tree | e3d43bfd62f9423c951df3bb3ea8dc2ba4aa2de3 | |
parent | caecb76180dfe85da79064e9733a3ca79c55f141 (diff) | |
download | qpid-python-c3c98db893d6e127dc5e0037fb2c3548e8f90a5a.tar.gz |
Propagate error messages across the Demux between network & user threads.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@667205 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | cpp/etc/qpidd.conf | 5 | ||||
-rw-r--r-- | cpp/src/qpid/client/Demux.cpp | 8 | ||||
-rw-r--r-- | cpp/src/qpid/client/Demux.h | 2 | ||||
-rw-r--r-- | cpp/src/qpid/client/SessionImpl.cpp | 4 | ||||
-rw-r--r-- | cpp/src/qpid/sys/BlockingQueue.h | 7 | ||||
-rw-r--r-- | cpp/src/tests/Makefile.am | 2 |
6 files changed, 16 insertions, 12 deletions
diff --git a/cpp/etc/qpidd.conf b/cpp/etc/qpidd.conf index 8064767e78..0ace726f26 100644 --- a/cpp/etc/qpidd.conf +++ b/cpp/etc/qpidd.conf @@ -1,2 +1,3 @@ -# Configuration file for qpidd. -# Using default settings, qpidd --help to see defaults. +# Configuration file for qpidd. Entries are of the form: +# name = value +# Using default settings: "qpidd --help" or "man qpidd" for more details. diff --git a/cpp/src/qpid/client/Demux.cpp b/cpp/src/qpid/client/Demux.cpp index cb9372cee7..b774214ae4 100644 --- a/cpp/src/qpid/client/Demux.cpp +++ b/cpp/src/qpid/client/Demux.cpp @@ -47,7 +47,7 @@ ScopedDivert::~ScopedDivert() Demux::Demux() : defaultQueue(new Queue()) {} -Demux::~Demux() { close(); } +Demux::~Demux() { close(sys::ExceptionHolder(new ClosedException())); } Demux::QueuePtr ScopedDivert::getQueue() { @@ -69,13 +69,13 @@ void Demux::handle(framing::FrameSet::shared_ptr frameset) } } -void Demux::close() +void Demux::close(const sys::ExceptionHolder& ex) { sys::Mutex::ScopedLock l(lock); for (iterator i = records.begin(); i != records.end(); i++) { - i->queue->close(); + i->queue->close(ex); } - defaultQueue->close(); + defaultQueue->close(ex); } void Demux::open() diff --git a/cpp/src/qpid/client/Demux.h b/cpp/src/qpid/client/Demux.h index 5c640f99d2..7304e799bb 100644 --- a/cpp/src/qpid/client/Demux.h +++ b/cpp/src/qpid/client/Demux.h @@ -53,7 +53,7 @@ public: ~Demux(); void handle(framing::FrameSet::shared_ptr); - void close(); + void close(const sys::ExceptionHolder& ex); void open(); QueuePtr add(const std::string& name, Condition); diff --git a/cpp/src/qpid/client/SessionImpl.cpp b/cpp/src/qpid/client/SessionImpl.cpp index 7b8cae943f..574c71ecd7 100644 --- a/cpp/src/qpid/client/SessionImpl.cpp +++ b/cpp/src/qpid/client/SessionImpl.cpp @@ -616,7 +616,9 @@ void SessionImpl::assertOpen() const void SessionImpl::handleClosed() { - demux.close(); + // FIXME aconway 2008-06-12: needs to be set to the correct exception type. + // + demux.close(sys::ExceptionHolder(text.empty() ? new ClosedException() : new Exception(text))); results.close(); } diff --git a/cpp/src/qpid/sys/BlockingQueue.h b/cpp/src/qpid/sys/BlockingQueue.h index dd709c6bff..86020fad81 100644 --- a/cpp/src/qpid/sys/BlockingQueue.h +++ b/cpp/src/qpid/sys/BlockingQueue.h @@ -79,13 +79,14 @@ public: } /** - * Close the queue. Throws ClosedException in threads waiting in pop(). - * Blocks till all waiting threads have been notified. + * Close the queue. + *@ex exception to throw to waiting threads. ClosedException by default. */ - void close() + void close(const ExceptionHolder& ex=ExceptionHolder(new ClosedException())) { Waitable::ScopedLock l(lock); if (!closed) { + lock.setException(ex); closed = true; lock.notifyAll(); lock.waitWaiters(); // Ensure no threads are still waiting. diff --git a/cpp/src/tests/Makefile.am b/cpp/src/tests/Makefile.am index 735d85b419..57d1c04b72 100644 --- a/cpp/src/tests/Makefile.am +++ b/cpp/src/tests/Makefile.am @@ -1,4 +1,4 @@ -AM_CXXFLAGS = $(WARNING_CFLAGS) $(CFLAGS) $(APR_CXXFLAGS) -DBOOST_TEST_DYN_LINK +AM_CXXFLAGS = $(WARNING_CFLAGS) -DBOOST_TEST_DYN_LINK INCLUDES = -I$(srcdir)/.. -I$(srcdir)/../gen -I$(top_builddir)/src/gen abs_builddir=@abs_builddir@ |