activemq-cpp-3.6.0
activemq::transport::failover::URIPool Class Reference

#include <src/main/activemq/transport/failover/URIPool.h>

Public Member Functions

 URIPool ()
 Create an Empty URI Pool.
 URIPool (const decaf::util::List< decaf::net::URI > &uris)
 Creates a new URI Pool using the given list as the initial Free List.
 URIPool (const URIPool &uris)
 Creates a new URI Pool which will be a copy of the given URI Pool.
URIPooloperator= (const URIPool &uris)
 Assignment operator, copies the contents of the given URIPool into this one.
 ~URIPool ()
const decaf::util::List
< decaf::net::URI > & 
getURIList () const
 Gets a static view of the URI List contained in this URI Pool.
bool isEmpty () const
const decaf::net::URIgetPriorityURI () const
 Returns the URI that is considered to be this Pools Priority URI, this is always the first URI in the list of URIs that this pool was created with.
void setPriorityURI (const decaf::net::URI &uri)
 Sets the URI that is considered this Pool's priority URI.
decaf::net::URI getURI ()
 Fetches the next available URI from the pool, if there are no more URIs free when this method is called it throws a NoSuchElementException.
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 always return the URI when they close the resource that was connected to that URI.
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 add those.
bool removeURI (const decaf::net::URI &uri)
 Remove a given URI from the Free List.
bool isRandomize () const
 Is the URI that is given randomly picked from the pool or is each one taken in sequence.
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 in the list.
bool contains (const decaf::net::URI &uri) const
 Returns true if the given URI is contained in this set of URIs.
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 clear ()
 Remove all URIs from the pool.
bool equals (const URIPool &other) const
 Compares the URIs in this set to that of another URIPool.

Constructor & Destructor Documentation

activemq::transport::failover::URIPool::URIPool ( )

Create an Empty URI Pool.

activemq::transport::failover::URIPool::URIPool ( const decaf::util::List< decaf::net::URI > &  uris)

Creates a new URI Pool using the given list as the initial Free List.

Parameters
uris- List of URI to place in the Pool.
activemq::transport::failover::URIPool::URIPool ( const URIPool uris)

Creates a new URI Pool which will be a copy of the given URI Pool.

Parameters
urisThe URIPool instance to copy.
activemq::transport::failover::URIPool::~URIPool ( )

Member Function Documentation

bool activemq::transport::failover::URIPool::addURI ( const decaf::net::URI uri)

Adds a URI to the free list, callers that have previously taken one using the getURI method should always return the URI when they close the resource that was connected to that URI.

Parameters
uri- a URI previously taken from the pool.
Returns
true if the URI was added or false if its already in the list.
bool activemq::transport::failover::URIPool::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 add those.

Parameters
uris- List of URIs to add into the Pool.
Returns
true if any URI was added or false if they were already in the list.
void activemq::transport::failover::URIPool::clear ( )

Remove all URIs from the pool.

bool activemq::transport::failover::URIPool::contains ( const decaf::net::URI uri) const

Returns true if the given URI is contained in this set of URIs.

Returns
true if the URI is in the list.
bool activemq::transport::failover::URIPool::equals ( const URIPool other) const

Compares the URIs in this set to that of another URIPool.

Returns
true if the URIPool instance contains the same values.
const decaf::net::URI& activemq::transport::failover::URIPool::getPriorityURI ( ) const
inline

Returns the URI that is considered to be this Pools Priority URI, this is always the first URI in the list of URIs that this pool was created with.

decaf::net::URI activemq::transport::failover::URIPool::getURI ( )

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 in the future, the caller should react accordingly.

Returns
the next free URI in the Pool.
Exceptions
NoSuchElementExceptionif there are none free currently.
const decaf::util::List<decaf::net::URI>& activemq::transport::failover::URIPool::getURIList ( ) const
inline

Gets a static view of the URI List contained in this URI Pool.

Returns
a static reference to this Pools list of URIs.
bool activemq::transport::failover::URIPool::isEmpty ( ) const
Returns
true if this URI Pool is empty.
bool activemq::transport::failover::URIPool::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.

Returns
true if the URI is index 0 in the URI list.
bool activemq::transport::failover::URIPool::isRandomize ( ) const
inline

Is the URI that is given randomly picked from the pool or is each one taken in sequence.

Returns
true if URI gets are random.
URIPool& activemq::transport::failover::URIPool::operator= ( const URIPool uris)

Assignment operator, copies the contents of the given URIPool into this one.

Parameters
urisThe URIPool whose contents are to be copied.
bool activemq::transport::failover::URIPool::removeURI ( const decaf::net::URI uri)

Remove a given URI from the Free List.

Parameters
uriThe URI to find and remove from the free list
Returns
true if the URI was removed or false if no change was made.
void activemq::transport::failover::URIPool::setPriorityURI ( const decaf::net::URI uri)
inline

Sets the URI that is considered this Pool's priority URI.

Parameters
uriThe configured priority URI for this pool.
void activemq::transport::failover::URIPool::setRandomize ( bool  value)
inline

Sets if the URI's that are taken from the pool are chosen Randomly or are taken in the order they are in the list.

Parameters
value- true indicates URI gets are random.

The documentation for this class was generated from the following file: