Package 

Class Hosts


  • 
    public class Hosts
    
                        

    Object to encapsulate primary host name and shuffled fallback host names. Methods on this class are safe to be called from any thread.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private final String primaryHost
    • Method Summary

      Modifier and Type Method Description
      String getPrimaryHost() Get primary host name
      synchronized void setPreferredHost(String prefHost, boolean temporary) set preferred hostname, which might not be the primary
      synchronized String getPreferredHost() Get preferred host name (taking into account any affinity to a fallback: see RSC15f)
      synchronized String getFallback(String lastHost) Get next fallback host if any
      synchronized int fallbackHostsRemaining(String candidateHost)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Hosts

        Hosts(String primaryHost, String defaultHost, ClientOptions options)
        Create Hosts object
        Parameters:
        primaryHost - the primary hostname, null if not configured
        defaultHost - the default hostname that the primary hostname mustmatch for fallback to occur
        options - ClientOptions to get environment and fallbackHosts fromThe fallback and environment processing here is used when the Hostsobject is used by a ConnectionManager (for a realtime connection) or byan HttpCore for a rest connection.