public class Host extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
Host.StateListener
Interface for listeners that are interested in hosts added, up, down and
removed events.
|
Modifier and Type | Method and Description |
---|---|
InetAddress |
getAddress()
Returns the node address.
|
VersionNumber |
getCassandraVersion()
The Cassandra version the host is running.
|
String |
getDatacenter()
Returns the name of the datacenter this host is part of.
|
com.google.common.util.concurrent.ListenableFuture<?> |
getInitialReconnectionAttemptFuture() |
String |
getRack()
Returns the name of the rack this host is part of.
|
InetSocketAddress |
getSocketAddress()
Returns the node socket address.
|
int |
hashCode() |
boolean |
isUp()
Returns whether the host is considered up by the driver.
|
String |
toString() |
public InetAddress getAddress()
This is a shortcut for getSocketAddress().getAddress()
.
InetAddress
.public InetSocketAddress getSocketAddress()
InetSocketAddress
.public String getDatacenter()
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.
public String getRack()
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.
public VersionNumber getCassandraVersion()
As for other host information fetch from Cassandra above, the returned version can theoretically be null if the information is unavailable.
public boolean isUp()
Please note that this is only the view of the driver and may not reflect
reality. In particular a node can be down but the driver hasn't detected
it yet, or it can have been restarted and 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.
public com.google.common.util.concurrent.ListenableFuture<?> getInitialReconnectionAttemptFuture()
Copyright © 2014. All rights reserved.