com.datastax.driver.core
Class Host

java.lang.Object
  extended by com.datastax.driver.core.Host

public class Host
extends Object

A Cassandra node. This class keeps the information the driver maintain on a given Cassandra node.


Nested Class Summary
static interface Host.StateListener
          Interface for listeners that are interested in hosts added, up, down and removed events.
 
Method Summary
 boolean equals(Object o)
           
 InetAddress getAddress()
          Returns the node address.
 String getDatacenter()
          Returns the name of the datacenter this host is part of.
 String getRack()
          Returns the name of the rack this host is part of.
 int hashCode()
           
 boolean isUp()
          Returns whether the host is considered up by the driver.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getAddress

public InetAddress getAddress()
Returns the node address.

Returns:
the node InetAddress.

getDatacenter

public String getDatacenter()
Returns the name of the datacenter this host is part of. The returned datacenter name is the one as known by Cassandra. It is also possible for this information to be unavailable. In that case this method returns null, and the caller should always be aware of this possibility.

Returns:
the Cassandra datacenter name or null if datacenter is unavailable.

getRack

public String getRack()
Returns the name of the rack this host is part of. The returned rack name is the one as known by Cassandra. It is also possible for this information to be unavailable. In that case this method returns null, and the caller should always aware of this possibility.

Returns:
the Cassandra rack name or null if the rack is unavailable

isUp

public boolean isUp()
Returns whether the host is considered up by the driver.

Please note that this is only the view of the driver may not reflect the reality. In particular a node can be down but the driver hasn't detected it yet, or he can have been restarted but the driver hasn't detected it yet (in particular, for hosts to which the driver does not connect (because the LoadBalancingPolicy.distance method says so), this information may be durably inaccurate). This information should thus only be considered as best effort and should not be relied upon too strongly.

Returns:
whether the node is considered up.

hashCode

public final int hashCode()
Overrides:
hashCode in class Object

equals

public final boolean equals(Object o)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All rights reserved.