public class Host extends Object
Modifier and Type | Class and Description |
---|---|
class |
Host.HealthMonitor
Deprecated.
See
getMonitor() . |
static interface |
Host.StateListener
Interface for listeners that are interested in hosts added, up, down and
removed events.
|
Modifier and Type | Method and Description |
---|---|
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()
Deprecated.
you are encouraged not to use the HealthMonitor anymore. To test
if a node is considered UP or not, you should use
isUp instead. To
register a Host.StateListener , you should do so at the Cluster level
through Cluster.register(com.datastax.driver.core.Host.StateListener) (registering against the HealtMonitor does
not work as intented: listeners will only be informed of onUp and onDown
events (not onAdd and onRemove) and you need to manually register against
every host. Cluster.register(com.datastax.driver.core.Host.StateListener) solves this). |
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() |
public InetAddress getAddress()
InetAddress
.public String getDatacenter()
null
, and the caller should always be aware
of this possibility.public String getRack()
null
, and the caller should always aware of this
possibility.public boolean isUp()
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.
@Deprecated public Host.HealthMonitor getMonitor()
isUp
instead. To
register a Host.StateListener
, you should do so at the Cluster level
through Cluster.register(com.datastax.driver.core.Host.StateListener)
(registering against the HealtMonitor does
not work as intented: listeners will only be informed of onUp and onDown
events (not onAdd and onRemove) and you need to manually register against
every host. Cluster.register(com.datastax.driver.core.Host.StateListener)
solves this).Host.StateListener
can also register against
the health monitor to be notified when this node is detected to be up or downHost.HealthMonitor
.Copyright © 2014. All Rights Reserved.