diff options
author | Gordon Sim <gsim@apache.org> | 2012-08-09 17:15:15 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2012-08-09 17:15:15 +0000 |
commit | e82202c905433ca80a2df6c56a624565fa8f1898 (patch) | |
tree | d1839636a0fcf65a15f367a6a279937f8b9e9023 /cpp | |
parent | 810ae31c100698b82210ae05e4cee06947efd116 (diff) | |
download | qpid-python-e82202c905433ca80a2df6c56a624565fa8f1898.tar.gz |
QPID-4200: Add exception handling to qpid::client::AutoCancel destructor
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1371320 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/include/qpid/client/SubscriptionManager.h | 4 | ||||
-rw-r--r-- | cpp/src/qpid/client/SubscriptionManagerImpl.cpp | 10 |
2 files changed, 12 insertions, 2 deletions
diff --git a/cpp/include/qpid/client/SubscriptionManager.h b/cpp/include/qpid/client/SubscriptionManager.h index b69819a8ff..404a9c6eb9 100644 --- a/cpp/include/qpid/client/SubscriptionManager.h +++ b/cpp/include/qpid/client/SubscriptionManager.h @@ -280,8 +280,8 @@ class QPID_CLIENT_CLASS_EXTERN SubscriptionManager : public sys::Runnable, publi /** AutoCancel cancels a subscription in its destructor */ class AutoCancel { public: - AutoCancel(SubscriptionManager& sm_, const std::string& tag_) : sm(sm_), tag(tag_) {} - ~AutoCancel() { sm.cancel(tag); } + AutoCancel(SubscriptionManager&, const std::string& tag); + ~AutoCancel(); private: SubscriptionManager& sm; std::string tag; diff --git a/cpp/src/qpid/client/SubscriptionManagerImpl.cpp b/cpp/src/qpid/client/SubscriptionManagerImpl.cpp index 7dead112e5..44f81776c0 100644 --- a/cpp/src/qpid/client/SubscriptionManagerImpl.cpp +++ b/cpp/src/qpid/client/SubscriptionManagerImpl.cpp @@ -28,6 +28,7 @@ #include <qpid/client/Session.h> #include <qpid/client/MessageListener.h> #include <qpid/framing/Uuid.h> +#include <qpid/log/Statement.h> #include <set> #include <sstream> @@ -167,6 +168,15 @@ void SubscriptionManagerImpl::setFlowControl(const std::string& name, uint32_t m setFlowControl(name, FlowControl(messages, bytes, window)); } +AutoCancel::AutoCancel(SubscriptionManager& sm_, const std::string& tag_) : sm(sm_), tag(tag_) {} +AutoCancel::~AutoCancel() { + try { + sm.cancel(tag); + } catch (const qpid::Exception& e) { + QPID_LOG(info, "Exception in AutoCancel destructor: " << e.what()); + } +} + }} // namespace qpid::client |