activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1478205 - in /activemq/activemq-cpp/trunk/activemq-cpp/src: main/activemq/transport/failover/FailoverTransport.cpp test/activemq/transport/failover/FailoverTransportTest.cpp
Date Wed, 01 May 2013 21:55:06 GMT
Author: tabish
Date: Wed May  1 21:55:05 2013
New Revision: 1478205

URL: http://svn.apache.org/r1478205
Log:
couple of small failover transport tweaks

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/transport/failover/FailoverTransportTest.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.cpp?rev=1478205&r1=1478204&r2=1478205&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/FailoverTransport.cpp
Wed May  1 21:55:05 2013
@@ -871,7 +871,7 @@ bool FailoverTransport::iterate() {
             } else {
 
                 if (this->impl->doRebalance) {
-                    if (isPriorityBackup() && connectList->getPriorityURI().equals(*this->impl->connectedTransportURI))
{
+                    if (this->impl->connectedToPrioirty || connectList->getPriorityURI().equals(*this->impl->connectedTransportURI))
{
                         // already connected to first in the list, no need to rebalance
                         this->impl->doRebalance = false;
                         return false;
@@ -941,8 +941,12 @@ bool FailoverTransport::iterate() {
                         this->impl->reconnectMutex.notifyAll();
                         this->impl->connectFailures = 0;
 
-                        this->impl->connectedToPrioirty =
-                            connectList->getPriorityURI().equals(uri) || this->impl->priorityUris->contains(uri);
+                        if (isPriorityBackup()) {
+                            this->impl->connectedToPrioirty = connectList->getPriorityURI().equals(uri)
||
+                                                              this->impl->priorityUris->contains(uri);
+                        } else {
+                            this->impl->connectedToPrioirty = false;
+                        }
 
                         // Make sure on initial startup, that the transportListener
                         // has been initialized for this instance.

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/transport/failover/FailoverTransportTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/transport/failover/FailoverTransportTest.cpp?rev=1478205&r1=1478204&r2=1478205&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/transport/failover/FailoverTransportTest.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/transport/failover/FailoverTransportTest.cpp
Wed May  1 21:55:05 2013
@@ -543,7 +543,7 @@ void FailoverTransportTest::disposeOf( c
 void FailoverTransportTest::testTransportHandlesConnectionControl() {
 
     std::string uri =
-        "failover://(mock://localhost:61616)?randomize=false";
+        "failover://(mock://localhost:61618?failOnCreate=true,mock://localhost:61616)?randomize=false";
 
     std::string reconnectStr = "mock://localhost:61613?name=Reconnect";
 
@@ -703,7 +703,7 @@ void FailoverTransportTest::testConnecte
         Thread::sleep( 200 );
     }
     CPPUNIT_ASSERT( failover->isConnected() == true );
-    CPPUNIT_ASSERT( failover->isConnectedToPriority() == true );
+    CPPUNIT_ASSERT( failover->isConnectedToPriority() == false );
 
     transport->close();
 



Mime
View raw message