Package com.datastax.driver.core
Enum HostDistance
- java.lang.Object
-
- java.lang.Enum<HostDistance>
-
- com.datastax.driver.core.HostDistance
-
- All Implemented Interfaces:
Serializable,Comparable<HostDistance>
public enum HostDistance extends Enum<HostDistance>
The distance to a Cassandra node as assigned by aLoadBalancingPolicy(through itsdistancemethod).The distance assigned to an host influences how many connections the driver maintains towards this host. If for a given host the assigned
HostDistanceisLOCALorREMOTE, some connections will be maintained by the driver to this host. More active connections will be kept toLOCALhost than to aREMOTEone (and thus well behavingLoadBalancingPolicyshould assign aREMOTEdistance 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,IGNOREDshould be assigned to hosts that should not be used by this driver (because they are in a remote data center for instance).
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static HostDistancevalueOf(String name)Returns the enum constant of this type with the specified name.static HostDistance[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
LOCAL
public static final HostDistance LOCAL
-
REMOTE
public static final HostDistance REMOTE
-
IGNORED
public static final HostDistance IGNORED
-
-
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 nameNullPointerException- if the argument is null
-
-