com.datastax.driver.core
Enum HostDistance

java.lang.Object
  extended by java.lang.Enum<HostDistance>
      extended by 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 a LoadBalancingPolicy (through its distance method). The distance assigned to an host influence 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 an 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 datacenter for instance).


Enum Constant Summary
IGNORED
           
LOCAL
           
REMOTE
           
 
Method Summary
static HostDistance valueOf(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.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

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 name
NullPointerException - if the argument is null


Copyright © 2013. All Rights Reserved.