qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject svn commit: r959751 - in /qpid/trunk/qpid/cpp: include/qpid/client/FailoverListener.h src/qpid/client/FailoverListener.cpp src/tests/ClusterFixture.cpp
Date Thu, 01 Jul 2010 19:19:48 GMT
Author: aconway
Date: Thu Jul  1 19:19:48 2010
New Revision: 959751

URL: http://svn.apache.org/viewvc?rev=959751&view=rev
Log:
Fix spordic failure in cluster_test testConnectionKnownHosts.

Very occasional failure of the form:
 cluster_test.cpp(547): error in "testConnectionKnownHosts": check kb0 == kb2 failed [42179
57640  != 44199 57640 ] ])
Fix is to avoid using possibly out-of-date initial-brokers data from the connection.
Only rely on updates received from the amq.failover exchange.

Modified:
    qpid/trunk/qpid/cpp/include/qpid/client/FailoverListener.h
    qpid/trunk/qpid/cpp/src/qpid/client/FailoverListener.cpp
    qpid/trunk/qpid/cpp/src/tests/ClusterFixture.cpp

Modified: qpid/trunk/qpid/cpp/include/qpid/client/FailoverListener.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/include/qpid/client/FailoverListener.h?rev=959751&r1=959750&r2=959751&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/include/qpid/client/FailoverListener.h (original)
+++ qpid/trunk/qpid/cpp/include/qpid/client/FailoverListener.h Thu Jul  1 19:19:48 2010
@@ -60,6 +60,12 @@ class FailoverListener : private Message
     /** Subscribe to amq.failover exchange. */
     QPID_CLIENT_EXTERN FailoverListener(Connection);
 
+    /** Subscribe to amq.failover exchange.
+    *@param useInitial If true use the connection's initial brokers as
+    * the initial value of getKnownBrokers
+    */
+    QPID_CLIENT_EXTERN FailoverListener(Connection, bool useInitial);
+
     QPID_CLIENT_EXTERN ~FailoverListener();
 
     /** Returns the latest list of known broker URLs. */
@@ -68,7 +74,8 @@ class FailoverListener : private Message
   private:
     void received(Message& msg);
     void run();
-
+    void init(bool);
+    
     mutable sys::Mutex lock;
     Connection connection;
     Session session;

Modified: qpid/trunk/qpid/cpp/src/qpid/client/FailoverListener.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/client/FailoverListener.cpp?rev=959751&r1=959750&r2=959751&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/client/FailoverListener.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/client/FailoverListener.cpp Thu Jul  1 19:19:48 2010
@@ -33,8 +33,16 @@ FailoverListener::FailoverListener(Conne
     connection(c),
     session(c.newSession(AMQ_FAILOVER+"."+framing::Uuid(true).str())),
     subscriptions(session)
-{
-    knownBrokers = c.getInitialBrokers();
+{ init(true); }
+
+FailoverListener::FailoverListener(Connection c, bool useInitial) :
+    connection(c),
+    session(c.newSession(AMQ_FAILOVER+"."+framing::Uuid(true).str())),
+    subscriptions(session)
+{ init(useInitial); }
+
+void FailoverListener::init(bool useInitial) {
+    if (useInitial) knownBrokers = connection.getInitialBrokers();
     if (session.exchangeQuery(arg::name=AMQ_FAILOVER).getNotFound()) {
         session.close();
         return;

Modified: qpid/trunk/qpid/cpp/src/tests/ClusterFixture.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/ClusterFixture.cpp?rev=959751&r1=959750&r2=959751&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/ClusterFixture.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/ClusterFixture.cpp Thu Jul  1 19:19:48 2010
@@ -142,7 +142,7 @@ void ClusterFixture::killWithSilencer(si
  *@param n if specified wait for the cluster size to be n, up to a timeout.
  */
 std::set<int> knownBrokerPorts(qpid::client::Connection& c, int n) {
-    FailoverListener fl(c);
+    FailoverListener fl(c, false);
     std::vector<qpid::Url> urls = fl.getKnownBrokers();
     if (n >= 0 && unsigned(n) != urls.size()) {
         // Retry up to 10 secs in .1 second intervals.



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message