public class ClusterReadView
extends java.lang.Object
implements java.io.Closeable
Read view of cluster state, updated via subscription of cluster events published on the event bus.
Constructor and Description |
---|
ClusterReadView(Cluster cluster) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Unsubscribe to cluster events.
|
scala.collection.immutable.Set<NodeMetrics> |
clusterMetrics()
Current cluster metrics.
|
boolean |
isAvailable()
Returns true if the node is not unreachable and not
Down
and not Removed . |
boolean |
isLeader()
Is this node the leader?
|
boolean |
isSingletonCluster()
Does the cluster consist of only one member?
|
boolean |
isTerminated()
Returns true if this cluster instance has be shutdown.
|
ClusterEvent.CurrentInternalStats |
latestStats()
INTERNAL API
|
scala.Option<Address> |
leader()
Get the address of the current leader.
|
scala.collection.immutable.SortedSet<Member> |
members()
Current cluster members, sorted by address.
|
Reachability |
reachability() |
void |
refreshCurrentState()
INTERNAL API
|
scala.collection.immutable.Set<Address> |
seenBy()
INTERNAL API
The nodes that has seen current version of the Gossip.
|
Member |
self() |
Address |
selfAddress() |
ClusterEvent.CurrentClusterState |
state() |
MemberStatus |
status()
Member status for this node (
MemberStatus ). |
scala.collection.immutable.Set<Member> |
unreachableMembers()
Members that has been detected as unreachable.
|
public ClusterReadView(Cluster cluster)
public Address selfAddress()
public ClusterEvent.CurrentClusterState state()
public Member self()
public boolean isTerminated()
public scala.collection.immutable.SortedSet<Member> members()
public scala.collection.immutable.Set<Member> unreachableMembers()
public MemberStatus status()
MemberStatus
).
NOTE: If the node has been removed from the cluster (and shut down) then it's status is set to the 'REMOVED' tombstone state
and is no longer present in the node ring or any other part of the gossiping state. However in order to maintain the
model and the semantics the user would expect, this method will in this situation return MemberStatus.Removed
.
public boolean isLeader()
public scala.Option<Address> leader()
public boolean isSingletonCluster()
public boolean isAvailable()
Down
and not Removed
.public Reachability reachability()
public scala.collection.immutable.Set<NodeMetrics> clusterMetrics()
public void refreshCurrentState()
public scala.collection.immutable.Set<Address> seenBy()
public ClusterEvent.CurrentInternalStats latestStats()
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable