Class FailoverUriPool
java.lang.Object
org.apache.qpid.jms.provider.failover.FailoverUriPool
Manages the list of available failover URIs that are used to connect
and recover a connection.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a new URI to the pool if not already contained within.voidAdds a list of new URIs to the pool if not already contained within.voidAdds a new URI to the pool if not already contained within.voidReports that the Failover Provider connected to the last URI returned from this pool.getList()Gets the current list of URIs.Returns the currently set value for nested options which will be added to each URI that is returned from the pool.getNext()Returns the next URI in the pool of URIs.booleanisEmpty()booleanbooleanRemove a URI from the pool if present, otherwise has no effect.voidRemoves all currently configured URIs from the pool, no new URIs will be served from this pool until new ones are added.voidreplaceAll(List<URI> replacements) Removes all currently configured URIs from the pool and replaces them with the new set given.voidsetRandomize(boolean random) Sets whether the URIs that are returned by this pool are returned in random order or not.intsize()toString()
-
Field Details
-
DEFAULT_RANDOMIZE_ENABLED
public static final boolean DEFAULT_RANDOMIZE_ENABLED- See Also:
-
-
Constructor Details
-
FailoverUriPool
public FailoverUriPool() -
FailoverUriPool
-
-
Method Details
-
size
public int size()- Returns:
- the current size of the URI pool.
-
isEmpty
public boolean isEmpty()- Returns:
- true if the URI pool is empty.
-
getNext
Returns the next URI in the pool of URIs. The URI will be shifted to the end of the list and not be attempted again until the full list has been returned once.- Returns:
- the next URI that should be used for a connection attempt.
-
connected
public void connected()Reports that the Failover Provider connected to the last URI returned from this pool. If the Pool is set to randomize this will result in the Pool of URIs being shuffled in preparation for the next connect cycle. -
isRandomize
public boolean isRandomize()- Returns:
- true if this pool returns the URI values in random order.
-
setRandomize
public void setRandomize(boolean random) Sets whether the URIs that are returned by this pool are returned in random order or not. If false the URIs are returned in FIFO order.- Parameters:
random- true to have the URIs returned in a random order.
-
add
Adds a new URI to the pool if not already contained within. The URI will have any nest options that have been configured added to its existing set of options.- Parameters:
uri- The new URI to add to the pool.
-
addAll
Adds a list of new URIs to the pool if not already contained within. The URIs will have any nest options that have been configured added to their existing set of options.- Parameters:
additions- The new list of URIs to add to the pool.
-
addFirst
Adds a new URI to the pool if not already contained within. The URI will have any nested options that have been configured added to its existing set of options. The URI is added to the head of the pooled URIs and will be the next value that is returned from the pool.- Parameters:
uri- The new URI to add to the pool.
-
remove
Remove a URI from the pool if present, otherwise has no effect.- Parameters:
uri- The URI to attempt to remove from the pool.- Returns:
- true if the given URI was removed from the pool.
-
removeAll
public void removeAll()Removes all currently configured URIs from the pool, no new URIs will be served from this pool until new ones are added. -
replaceAll
Removes all currently configured URIs from the pool and replaces them with the new set given.- Parameters:
replacements- The new set of failover URIs to serve from this pool.
-
getList
Gets the current list of URIs. The returned list is a copy.- Returns:
- a copy of the current list of URIs in the pool.
-
getNestedOptions
Returns the currently set value for nested options which will be added to each URI that is returned from the pool.- Returns:
- the Map instance containing the nest options which can be empty if none set.
-
toString
-