public interface ClusterService extends CoreService, Cluster
This API is an internal API; the end user will use the Cluster
interface.
Modifier and Type | Method and Description |
---|---|
ClusterClock |
getClusterClock()
Returns the
ClusterClock of the cluster. |
String |
getClusterId()
Returns UUID for the cluster.
|
Member |
getLocalMember()
Gets the local member instance.
|
Address |
getMasterAddress()
Returns the address of the master member.
|
MemberImpl |
getMember(Address address)
Gets the member for the given address.
|
MemberImpl |
getMember(String uuid)
Gets the member with the given UUID.
|
Collection<MemberImpl> |
getMemberImpls()
Gets the collection of members.
|
int |
getMemberListJoinVersion()
Returns the member list join version of the local member instance.
|
int |
getMemberListVersion()
Returns the current version of member list.
|
Collection<Member> |
getMembers(MemberSelector selector)
Returns a collection of the members that satisfy the given
MemberSelector . |
int |
getSize()
Gets the current number of members.
|
int |
getSize(MemberSelector selector)
Gets the number of members that satisfy the given
MemberSelector instance. |
Address |
getThisAddress()
Gets the address of this member.
|
boolean |
isJoined()
Returns whether this member joined to a cluster.
|
boolean |
isMaster()
Checks if this member is the master.
|
addMembershipListener, changeClusterState, changeClusterState, changeClusterVersion, changeClusterVersion, getClusterState, getClusterTime, getClusterVersion, getHotRestartService, getMembers, promoteLocalLiteMember, removeMembershipListener, shutdown, shutdown
MemberImpl getMember(Address address)
address
- the address of the member to lookupnull
if not found (if the address is null
, null
is returned)MemberImpl getMember(String uuid)
uuid
- the UUID of the membernull
if not found (if the UUID is null
, null
is returned)Collection<MemberImpl> getMemberImpls()
If we take care of the generics.
null
)Collection<Member> getMembers(MemberSelector selector)
MemberSelector
.selector
- MemberSelector
instance to filter members to returnMemberSelector
Address getMasterAddress()
null
if the master is not yet known)boolean isMaster()
true
if master, false
otherwiseboolean isJoined()
true
if this member is joined to a cluster, false
otherwiseAddress getThisAddress()
null
)Member getLocalMember()
The returned value will never be null, but it may change when local lite member is promoted to a data member
via Cluster.promoteLocalLiteMember()
or when this member merges to a new cluster after split-brain detected. Returned value should not be
cached but instead this method should be called each time when local member is needed.
getLocalMember
in interface Cluster
null
)int getSize()
int getSize(MemberSelector selector)
MemberSelector
instance.selector
- MemberSelector
instance that filters members to be countedMemberSelector
instanceClusterClock getClusterClock()
ClusterClock
of the cluster.
The returned value will never be null
and will never change.
String getClusterId()
int getMemberListVersion()
int getMemberListJoinVersion()
The join algorithm assigns different member list join versions to each member in the cluster. If two members join at the same time, they will appear on different version of member list.
The uniqueness guarantee of member list join versions is provided except the following scenario: when there is a split-brain issue, if a new node joins to any sub-cluster, it can get a duplicate member list join version, i.e., its member list join version can be assigned to another node in the other sub-cluster(s).
When duplicate member list join version is assigned during network split, the returned value can change to make it unique again. Therefore the caller should call this method repeatedly.
IllegalStateException
- if the local instance is not joined or the cluster just upgraded to 3.10,
but local member has not yet learned its join version from the master node.UnsupportedOperationException
- if the cluster version is below 3.10Copyright © 2018 Hazelcast, Inc.. All Rights Reserved.