Enum HostDistance

  • All Implemented Interfaces:
    Serializable, Comparable<HostDistance>

    public enum HostDistance
    extends Enum<HostDistance>
    The distance to a Cassandra node as assigned by a LoadBalancingPolicy (through its distance method).

    The distance assigned to an host influences how many connections the driver maintains towards this host. If for a given host the assigned HostDistance is LOCAL or REMOTE, some connections will be maintained by the driver to this host. More active connections will be kept to LOCAL host than to a REMOTE one (and thus well behaving LoadBalancingPolicy should assign a REMOTE distance only to hosts that are the less often queried).

    However, if a host is assigned the distance IGNORED, no connection to that host will maintained active. In other words, IGNORED should be assigned to hosts that should not be used by this driver (because they are in a remote data center for instance).

    • Method Detail

      • values

        public static HostDistance[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (HostDistance c : HostDistance.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static HostDistance valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null