diff options
author | Alan Conway <aconway@apache.org> | 2009-03-03 20:21:01 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2009-03-03 20:21:01 +0000 |
commit | dc982976590c95beee9e2e0d602f974f5a8933a3 (patch) | |
tree | 2d55eb5e6e930d83ee0d9e2777721e78a5c79597 /cpp/src/qpid/cluster/UpdateClient.cpp | |
parent | 734f7b2a8defd7a816297e17c112ba2ba2b5d2d9 (diff) | |
download | qpid-python-dc982976590c95beee9e2e0d602f974f5a8933a3.tar.gz |
cluster::UpdateClient added missing error handling.
Minor improvements to failover_soak tests.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@749730 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/cluster/UpdateClient.cpp')
-rw-r--r-- | cpp/src/qpid/cluster/UpdateClient.cpp | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/cpp/src/qpid/cluster/UpdateClient.cpp b/cpp/src/qpid/cluster/UpdateClient.cpp index 4a4af4adbd..9cba377122 100644 --- a/cpp/src/qpid/cluster/UpdateClient.cpp +++ b/cpp/src/qpid/cluster/UpdateClient.cpp @@ -106,6 +106,16 @@ UpdateClient::~UpdateClient() {} // Reserved exchange/queue name for catch-up, avoid clashes with user queues/exchanges. const std::string UpdateClient::UPDATE("qpid.qpid-update"); +void UpdateClient::run() { + try { + update(); + done(); + } catch (const std::exception& e) { + failed(e); + } + delete this; +} + void UpdateClient::update() { QPID_LOG(debug, updaterId << " updating state to " << updateeId << " at " << updateeUrl); Broker& b = updaterBroker; @@ -130,16 +140,6 @@ void UpdateClient::update() { QPID_LOG(debug, updaterId << " updated state to " << updateeId << " at " << updateeUrl); } -void UpdateClient::run() { - try { - update(); - done(); - } catch (const std::exception& e) { - failed(e); - } - delete this; -} - namespace { template <class T> std::string encode(const T& t) { std::string encoded; @@ -172,7 +172,13 @@ class MessageUpdater { } ~MessageUpdater() { - session.exchangeUnbind(queue, UpdateClient::UPDATE); + try { + session.exchangeUnbind(queue, UpdateClient::UPDATE); + } + catch (const std::exception& e) { + // Don't throw in a destructor. + QPID_LOG(error, "Unbinding update queue " << queue << ": " << e.what()); + } } @@ -204,11 +210,8 @@ class MessageUpdater { void updateMessage(const boost::intrusive_ptr<broker::Message>& message) { updateQueuedMessage(broker::QueuedMessage(0, message, haveLastPos? lastPos.getValue()+1 : 1)); } - - }; - void UpdateClient::updateQueue(const boost::shared_ptr<Queue>& q) { QPID_LOG(debug, updaterId << " updating queue " << q->getName()); ClusterConnectionProxy proxy(session); |