diff options
| author | Gordon Sim <gsim@apache.org> | 2008-11-07 14:08:29 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2008-11-07 14:08:29 +0000 |
| commit | 82cb5b781573bbdd314bae51694ffada3312b5da (patch) | |
| tree | 8b0918a47453c49a95a3f0f8510cd425322e3c69 /cpp/src/qpid/client/FailoverManager.cpp | |
| parent | 897cdd6405ed312afb0a1649ba1c80f7011279e8 (diff) | |
| download | qpid-python-82cb5b781573bbdd314bae51694ffada3312b5da.tar.gz | |
* Added some doxygen comments for FailoverManager
* Added means for application to alter the order in which urls are tried (or indeed the list of urls to try)
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@712127 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client/FailoverManager.cpp')
| -rw-r--r-- | cpp/src/qpid/client/FailoverManager.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/cpp/src/qpid/client/FailoverManager.cpp b/cpp/src/qpid/client/FailoverManager.cpp index 73c6bfc2de..ab9dbca70f 100644 --- a/cpp/src/qpid/client/FailoverManager.cpp +++ b/cpp/src/qpid/client/FailoverManager.cpp @@ -28,7 +28,8 @@ namespace client { using qpid::sys::Monitor; -FailoverManager::FailoverManager(const ConnectionSettings& s) : settings(s), state(IDLE) {} +FailoverManager::FailoverManager(const ConnectionSettings& s, + ReconnectionStrategy* rs) : settings(s), strategy(rs), state(IDLE) {} void FailoverManager::execute(Command& c) { @@ -38,11 +39,11 @@ void FailoverManager::execute(Command& c) try { AsyncSession session = connect().newSession(); c.execute(session, retry); - session.sync();//TODO: shouldn't be required, but seems there is a bug in session + session.sync();//TODO: shouldn't be required session.close(); completed = true; } catch(const TransportFailure&) { - retry = true; + retry = true; } } } @@ -86,6 +87,7 @@ Connection& FailoverManager::getConnection() void FailoverManager::attempt(Connection& c, ConnectionSettings s, std::vector<Url> urls) { Monitor::ScopedUnlock u(lock); + if (strategy) strategy->editUrlList(urls); if (urls.empty()) { attempt(c, s); } else { @@ -105,7 +107,9 @@ void FailoverManager::attempt(Connection& c, ConnectionSettings s, std::vector<U void FailoverManager::attempt(Connection& c, ConnectionSettings s) { try { + QPID_LOG(info, "Attempting to connect to " << s.host << " on " << s.port << "..."); c.open(s); + QPID_LOG(info, "Connected to " << s.host << " on " << s.port); } catch (const Exception& e) { QPID_LOG(info, "Could not connect to " << s.host << " on " << s.port << ": " << e.what()); } |
