activemq-cpp-3.9.5
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
22
23#include <decaf/net/URI.h>
26
27namespace activemq {
28namespace transport {
29namespace failover {
30
32 private:
33
35 decaf::net::URI priorityURI;
36 bool randomize;
37
38 public:
39
44
51
58 URIPool(const URIPool& uris);
59
66 URIPool& operator= (const URIPool& uris);
67
69
76 return this->uriPool;
77 }
78
82 bool isEmpty() const;
83
89 return this->priorityURI;
90 }
91
99 this->priorityURI = uri;
100 }
101
113
123 bool addURI(const decaf::net::URI& uri);
124
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_*/
#define AMQCPP_API
Definition Config.h:30
decaf::net::URI getURI()
Fetches the next available URI from the pool, if there are no more URIs free when this method is call...
bool equals(const URIPool &other) const
Compares the URIs in this set to that of another URIPool.
bool addURI(const decaf::net::URI &uri)
Adds a URI to the free list, callers that have previously taken one using the getURI method should al...
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
URIPool(const decaf::util::List< decaf::net::URI > &uris)
Creates a new URI Pool using the given list as the initial Free List.
bool removeURI(const decaf::net::URI &uri)
Remove a given URI from the Free List.
URIPool()
Create an Empty URI Pool.
URIPool(const URIPool &uris)
Creates a new URI Pool which will be a copy of the given URI Pool.
bool isPriority(const decaf::net::URI &uri) const
Returns true if the URI given is the first in the list of URIs contained in this pool.
void setRandomize(bool value)
Sets if the URI's that are taken from the pool are chosen Randomly or are taken in the order they are...
Definition URIPool.h:161
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 addURIs(const decaf::util::List< decaf::net::URI > &uris)
Adds a List of URIs to this Pool, the method checks for duplicates already in the pool and does not a...
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
void clear()
Remove all URIs from the pool.
bool contains(const decaf::net::URI &uri) const
Returns true if the given URI is contained in this set of URIs.
void setPriorityURI(const decaf::net::URI &uri)
Sets the URI that is considered this Pool's priority URI.
Definition URIPool.h:98
This class represents an instance of a URI as defined by RFC 2396.
Definition URI.h:37
A complete implementation of the List interface using a doubly linked list data structure.
Definition LinkedList.h:55
An ordered collection (also known as a sequence).
Definition List.h:47
Definition BackupTransport.h:31
Definition AbstractTransportFactory.h:30
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition CachedConsumer.h:24