activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1446789 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/transport/failover: URIPool.cpp URIPool.h
Date Fri, 15 Feb 2013 22:19:01 GMT
Author: tabish
Date: Fri Feb 15 22:19:01 2013
New Revision: 1446789

URL: http://svn.apache.org/r1446789
Log:
Add isEmpty

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=1446789&r1=1446788&r2=1446789&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
Fri Feb 15 22:19:01 2013
@@ -138,3 +138,12 @@ void URIPool::clear() {
         this->uriPool.clear();
     }
 }
+
+////////////////////////////////////////////////////////////////////////////////
+bool URIPool::isEmpty() const {
+    bool result = true;
+    synchronized(&uriPool) {
+        result = this->uriPool.isEmpty();
+    }
+    return result;
+}

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=1446789&r1=1446788&r2=1446789&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
Fri Feb 15 22:19:01 2013
@@ -28,13 +28,10 @@ namespace activemq {
 namespace transport {
 namespace failover {
 
-    using decaf::util::LinkedList;
-    using decaf::net::URI;
-
     class AMQCPP_API URIPool {
     private:
 
-        mutable LinkedList<URI> uriPool;
+        mutable decaf::util::LinkedList<decaf::net::URI> uriPool;
         bool randomize;
 
     public:
@@ -49,11 +46,16 @@ namespace failover {
          *
          * @param uris - List of URI to place in the Pool.
          */
-        URIPool(const decaf::util::List<URI>& uris);
+        URIPool(const decaf::util::List<decaf::net::URI>& uris);
 
         ~URIPool();
 
         /**
+         * @returns true if this URI Pool is empty.
+         */
+        bool isEmpty() const;
+
+        /**
          * 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
@@ -63,7 +65,7 @@ namespace failover {
          *
          * @throw NoSuchElementException if there are none free currently.
          */
-        URI getURI();
+        decaf::net::URI getURI();
 
         /**
          * Adds a URI to the free list, callers that have previously taken one using
@@ -74,7 +76,7 @@ namespace failover {
          *
          * @returns true if the URI was added or false if its already in the list.
          */
-        bool addURI(const URI& uri);
+        bool addURI(const decaf::net::URI& uri);
 
         /**
          * Adds a List of URIs to this Pool, the method checks for duplicates already
@@ -84,7 +86,7 @@ namespace failover {
          *
          * @returns true if any URI was added or false if they were already in the list.
          */
-        bool addURIs(const LinkedList<URI>& uris);
+        bool addURIs(const decaf::util::List<decaf::net::URI>& uris);
 
         /**
          * Remove a given URI from the Free List.
@@ -94,7 +96,7 @@ namespace failover {
          *
          * @returns true if the URI was removed or false if no change was made.
          */
-        bool removeURI(const URI& uri);
+        bool removeURI(const decaf::net::URI& uri);
 
         /**
          * Is the URI that is given randomly picked from the pool or is



Mime
View raw message