Class FailoverUriPool

java.lang.Object
org.apache.qpid.jms.provider.failover.FailoverUriPool

public class FailoverUriPool extends Object
Manages the list of available failover URIs that are used to connect and recover a connection.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final boolean
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    FailoverUriPool(List<URI> uris, Map<String,String> nestedOptions)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(URI uri)
    Adds a new URI to the pool if not already contained within.
    void
    addAll(List<URI> additions)
    Adds a list of new URIs to the pool if not already contained within.
    void
    Adds a new URI to the pool if not already contained within.
    void
    Reports that the Failover Provider connected to the last URI returned from this pool.
    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.
    Returns the next URI in the pool of URIs.
    boolean
     
    boolean
     
    boolean
    remove(URI uri)
    Remove a URI from the pool if present, otherwise has no effect.
    void
    Removes all currently configured URIs from the pool, no new URIs will be served from this pool until new ones are added.
    void
    replaceAll(List<URI> replacements)
    Removes all currently configured URIs from the pool and replaces them with the new set given.
    void
    setRandomize(boolean random)
    Sets whether the URIs that are returned by this pool are returned in random order or not.
    int
     
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • DEFAULT_RANDOMIZE_ENABLED

      public static final boolean DEFAULT_RANDOMIZE_ENABLED
      See Also:
  • Constructor Details

    • FailoverUriPool

      public FailoverUriPool()
    • FailoverUriPool

      public FailoverUriPool(List<URI> uris, Map<String,String> nestedOptions)
  • 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

      public URI 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

      public void add(URI uri)
      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

      public void addAll(List<URI> additions)
      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

      public void addFirst(URI uri)
      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

      public boolean remove(URI uri)
      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

      public void replaceAll(List<URI> replacements)
      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

      public List<URI> 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

      public Map<String,String> 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

      public String toString()
      Overrides:
      toString in class Object