activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1447401 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover: URIPool.cpp URIPool.h
Date Mon, 18 Feb 2013 17:42:14 GMT
Author: tabish
Date: Mon Feb 18 17:42:13 2013
New Revision: 1447401

URL: http://svn.apache.org/r1447401
Log:
https://issues.apache.org/jira/browse/AMQCPP-463

Ensure the URI pool knows what its priority URI is. 

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/URIPool.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/URIPool.h

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/URIPool.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/URIPool.cpp?rev=1447401&r1=1447400&r2=1447401&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/URIPool.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/URIPool.cpp
Mon Feb 18 17:42:13 2013
@@ -96,6 +96,11 @@ URI URIPool::getURI() {
 bool URIPool::addURI(const URI& uri) {
 
     synchronized(&uriPool) {
+
+        if (priorityURI.toString() == "" && uri.toString() != "") {
+            priorityURI = uri;
+        }
+
         if (!uriPool.contains(uri)) {
             uriPool.add(uri);
             return true;
@@ -116,6 +121,10 @@ bool URIPool::addURIs(const List<URI>& u
         while (iter->hasNext()) {
             URI uri = iter->next();
 
+            if (priorityURI.toString() == "" && uri.toString() != "") {
+                priorityURI = uri;
+            }
+
             if (!uriPool.contains(uri)) {
                 uriPool.add(uri);
                 result = true;

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/URIPool.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/URIPool.h?rev=1447401&r1=1447400&r2=1447401&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/URIPool.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover/URIPool.h
Mon Feb 18 17:42:13 2013
@@ -81,6 +81,16 @@ namespace failover {
         }
 
         /**
+         * Sets the URI that is considered this Pool's priority URI.
+         *
+         * @param uri
+         *      The configured priority URI for this pool.
+         */
+        void setPriorityURI(const decaf::net::URI& uri) {
+            this->priorityURI = uri;
+        }
+
+        /**
          * Fetches the next available URI from the pool, if there are no more
          * URIs free when this method is called it throws a NoSuchElementException.
          * Receiving the exception is not an indication that a URI won't be available



Mime
View raw message