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 informations the driver maintain on a given Cassandra node.


Nested Class Summary
 class Host.HealthMonitor
          Tracks the health of a node and notify listeners when a host is considered up or down.
static interface Host.StateListener
          Interface for listeners that are interested in hosts add, up, down and remove 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.
 Host.HealthMonitor getMonitor()
          Returns the health monitor for this host.
 String getRack()
          Returns the name of the rack this host is part of.
 int hashCode()
           
 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. Also note that it is possible for this information to not be available. In that case this method returns null and caller should always expect that possibility.

Returns:
the Cassandra datacenter name.

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. Also note that it is possible for this information to not be available. In that case this method returns null and caller should always expect that possibility.

Returns:
the Cassandra rack name.

getMonitor

public Host.HealthMonitor getMonitor()
Returns the health monitor for this host. The health monitor keeps tracks of the known host state (up or down). A class implementing Host.StateListener can also register against the healt monitor to be notified when this node is detected down/up.

Returns:
the host Host.HealthMonitor.

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.