summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/ha/Primary.cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2012-07-31 16:11:44 +0000
committerAlan Conway <aconway@apache.org>2012-07-31 16:11:44 +0000
commitb0ebff8d8290b777962b8718b46070ed990f6855 (patch)
tree042ca6c5dd2548891f4e5cdcbb05121cf5647f0b /cpp/src/qpid/ha/Primary.cpp
parent4acfc5608c2330d7b0e980061c06764c2f094d27 (diff)
downloadqpid-python-b0ebff8d8290b777962b8718b46070ed990f6855.tar.gz
QPID-4176: HA Error handling
Additional error handling and logging for ConnectionObserver, Primary and ReplicatingSubscription. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1367649 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/ha/Primary.cpp')
-rw-r--r--cpp/src/qpid/ha/Primary.cpp42
1 files changed, 24 insertions, 18 deletions
diff --git a/cpp/src/qpid/ha/Primary.cpp b/cpp/src/qpid/ha/Primary.cpp
index e7aa4858be..69c94bfc7d 100644
--- a/cpp/src/qpid/ha/Primary.cpp
+++ b/cpp/src/qpid/ha/Primary.cpp
@@ -141,26 +141,32 @@ void Primary::checkReady(BackupMap::iterator i, Mutex::ScopedLock& l) {
}
void Primary::timeoutExpectedBackups() {
- sys::Mutex::ScopedLock l(lock);
- if (active) return; // Already activated
- // Remove records for any expectedBackups that are not yet connected
- // Allow backups that are connected to continue becoming ready.
- for (BackupSet::iterator i = expectedBackups.begin(); i != expectedBackups.end();)
- {
- boost::shared_ptr<RemoteBackup> rb = *i;
- if (!rb->isConnected()) {
- BrokerInfo info = rb->getBrokerInfo();
- QPID_LOG(error, logPrefix << "Expected backup timed out: " << info);
- expectedBackups.erase(i++);
- backups.erase(info.getSystemId());
- rb->cancel();
- // Downgrade the broker to CATCHUP
- info.setStatus(CATCHUP);
- haBroker.addBroker(info);
+ try {
+ sys::Mutex::ScopedLock l(lock);
+ if (active) return; // Already activated
+ // Remove records for any expectedBackups that are not yet connected
+ // Allow backups that are connected to continue becoming ready.
+ for (BackupSet::iterator i = expectedBackups.begin(); i != expectedBackups.end();)
+ {
+ boost::shared_ptr<RemoteBackup> rb = *i;
+ if (!rb->isConnected()) {
+ BrokerInfo info = rb->getBrokerInfo();
+ QPID_LOG(error, logPrefix << "Expected backup timed out: " << info);
+ expectedBackups.erase(i++);
+ backups.erase(info.getSystemId());
+ rb->cancel();
+ // Downgrade the broker to CATCHUP
+ info.setStatus(CATCHUP);
+ haBroker.addBroker(info);
+ }
+ else ++i;
}
- else ++i;
+ checkReady(l);
+ }
+ catch(const std::exception& e) {
+ QPID_LOG(error, logPrefix << "Error timing out backups: " << e.what());
+ // No-where for this exception to go.
}
- checkReady(l);
}
void Primary::readyReplica(const ReplicatingSubscription& rs) {