public interface Node
This object is mutable, all of its properties may be updated at runtime to reflect the latest state of the node.
Modifier and Type | Method and Description |
---|---|
Optional<InetSocketAddress> |
getBroadcastAddress()
The node's broadcast address.
|
Optional<InetSocketAddress> |
getBroadcastRpcAddress()
The node's broadcast RPC address.
|
Version |
getCassandraVersion()
The Cassandra version of the server.
|
String |
getDatacenter()
The datacenter that this node belongs to (according to the server-side snitch).
|
NodeDistance |
getDistance()
The distance assigned to this node by the
LoadBalancingPolicy , that controls certain
aspects of connection management. |
EndPoint |
getEndPoint()
The information that the driver uses to connect to the node.
|
Map<String,Object> |
getExtras()
An additional map of free-form properties.
|
UUID |
getHostId()
The host ID that is assigned to this node by Cassandra.
|
Optional<InetSocketAddress> |
getListenAddress()
The node's listen address.
|
int |
getOpenConnections()
The total number of active connections currently open by this driver instance to the node.
|
String |
getRack()
The rack that this node belongs to (according to the server-side snitch).
|
UUID |
getSchemaVersion()
The current version that is associated with the node's schema.
|
NodeState |
getState() |
long |
getUpSinceMillis()
The last time that this node transitioned to the UP state, in milliseconds since the epoch, or
-1 if it's not up at the moment.
|
boolean |
isReconnecting()
Whether the driver is currently trying to reconnect to this node.
|
@NonNull EndPoint getEndPoint()
@NonNull Optional<InetSocketAddress> getBroadcastRpcAddress()
This is the address that the node expects clients to connect to, as reported in system.peers.rpc_address
(Cassandra 3) or system.peers_v2.native_address/native_port
(Cassandra 4+). However, it might not be what the driver uses directly, if the node is accessed
through a proxy.
This may not be known at all times. In particular, some Cassandra versions (less than
2.0.16, 2.1.6 or 2.2.0-rc1) don't store it in the system.local
table, so this will be
unknown for the control node, until the control connection reconnects to another node.
@NonNull Optional<InetSocketAddress> getBroadcastAddress()
peer
column in system.peers
. If the
port is set to 0 it is unknown.
This may not be known at all times. In particular, some Cassandra versions (less than
2.0.16, 2.1.6 or 2.2.0-rc1) don't store it in the system.local
table, so this will be
unknown for the control node, until the control connection reconnects to another node.
@NonNull Optional<InetSocketAddress> getListenAddress()
This may not be know at all times. In particular, current Cassandra versions (3.10) only
store it in system.local
, so this will be known only for the control node.
@Nullable String getDatacenter()
This should be non-null in a healthy deployment, but the driver will still function, and
report null
here, if the server metadata was corrupted.
@Nullable String getRack()
This should be non-null in a healthy deployment, but the driver will still function, and
report null
here, if the server metadata was corrupted.
@Nullable Version getCassandraVersion()
This should be non-null in a healthy deployment, but the driver will still function, and
report null
here, if the server metadata was corrupted or the reported version could
not be parsed.
@NonNull Map<String,Object> getExtras()
This is intended for future evolution or custom driver extensions. The contents of this map are unspecified and may change at any point in time, always check for the existence of a key before using it.
Note that the returned map is immutable: if the properties change, this is reflected by publishing a new map instance, therefore you must call this method again to see the changes.
@NonNull NodeState getState()
long getUpSinceMillis()
int getOpenConnections()
boolean isReconnecting()
@NonNull NodeDistance getDistance()
LoadBalancingPolicy
, that controls certain
aspects of connection management.
This is exposed here for information only. Distance events are handled internally by the driver.
@Nullable UUID getHostId()
This should be non-null in a healthy deployment, but the driver will still function, and
report null
here, if the server metadata was corrupted.
@Nullable UUID getSchemaVersion()
This should be non-null in a healthy deployment, but the driver will still function, and
report null
here, if the server metadata was corrupted.
Copyright © 2017–2019. All rights reserved.