activemq-cpp-3.8.2
URIPool.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef _ACTIVEMQ_TRANSPORT_FAILOVER_URIPOOL_H_
19 #define _ACTIVEMQ_TRANSPORT_FAILOVER_URIPOOL_H_
20 
21 #include <activemq/util/Config.h>
22 
23 #include <decaf/net/URI.h>
24 #include <decaf/util/LinkedList.h>
26 
27 namespace activemq {
28 namespace transport {
29 namespace failover {
30 
32  private:
33 
35  decaf::net::URI priorityURI;
36  bool randomize;
37 
38  public:
39 
43  URIPool();
44 
51 
58  URIPool(const URIPool& uris);
59 
66  URIPool& operator= (const URIPool& uris);
67 
68  ~URIPool();
69 
76  return this->uriPool;
77  }
78 
82  bool isEmpty() const;
83 
89  return this->priorityURI;
90  }
91 
98  void setPriorityURI(const decaf::net::URI& uri) {
99  this->priorityURI = uri;
100  }
101 
112  decaf::net::URI getURI();
113 
123  bool addURI(const decaf::net::URI& uri);
124 
133  bool addURIs(const decaf::util::List<decaf::net::URI>& uris);
134 
143  bool removeURI(const decaf::net::URI& uri);
144 
151  bool isRandomize() const {
152  return this->randomize;
153  }
154 
161  void setRandomize(bool value) {
162  this->randomize = value;
163  }
164 
170  bool contains(const decaf::net::URI& uri) const;
171 
178  bool isPriority(const decaf::net::URI& uri) const;
179 
183  void clear();
184 
190  bool equals(const URIPool& other) const;
191 
192  };
193 
194 }}}
195 
196 #endif /*_ACTIVEMQ_TRANSPORT_FAILOVER_URIPOOL_H_*/
const decaf::util::List< decaf::net::URI > & getURIList() const
Gets a static view of the URI List contained in this URI Pool.
Definition: URIPool.h:75
#define AMQCPP_API
Definition: Config.h:30
void setPriorityURI(const decaf::net::URI &uri)
Sets the URI that is considered this Pool&#39;s priority URI.
Definition: URIPool.h:98
void setRandomize(bool value)
Sets if the URI&#39;s that are taken from the pool are chosen Randomly or are taken in the order they are...
Definition: URIPool.h:161
This class represents an instance of a URI as defined by RFC 2396.
Definition: URI.h:36
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: CachedConsumer.h:24
const decaf::net::URI & getPriorityURI() const
Returns the URI that is considered to be this Pools Priority URI, this is always the first URI in the...
Definition: URIPool.h:88
bool isRandomize() const
Is the URI that is given randomly picked from the pool or is each one taken in sequence.
Definition: URIPool.h:151