com.hazelcast.client.proxy
Constructor and Description |
---|
ClientClusterProxy(ClientClusterServiceImpl clusterService) |
Modifier and Type | Method and Description |
---|---|
String |
addMembershipListener(MembershipListener listener)
Adds MembershipListener to listen for membership updates.
|
long |
getClusterTime()
Returns the cluster-wide time in milliseconds.
|
Member |
getLocalMember()
Returns this Hazelcast instance member.
|
Set<Member> |
getMembers()
Set of the current members in the cluster.
|
boolean |
removeMembershipListener(String registrationId)
Removes the specified MembershipListener.
|
public ClientClusterProxy(ClientClusterServiceImpl clusterService)
public String addMembershipListener(MembershipListener listener)
Cluster
The addMembershipListener method returns a register-id. This id is needed to remove the MembershipListener using the
Cluster.removeMembershipListener(String)
method.
If the MembershipListener implements the InitialMembershipListener
interface, it will also receive
the InitialMembershipEvent
.
There is no check for duplicate registrations, so if you register the listener twice, it will get events twice.
addMembershipListener
in interface Cluster
listener
- membership listenerCluster.removeMembershipListener(String)
public boolean removeMembershipListener(String registrationId)
Cluster
If the same MembershipListener is registered multiple times, it needs to be removed multiple times. This method can safely be called multiple times for the same registration-id; subsequent calls are ignored.
removeMembershipListener
in interface Cluster
registrationId
- the registrationId of MembershipListener to remove.Cluster.addMembershipListener(MembershipListener)
public Set<Member> getMembers()
Cluster
The returned set is backed by an ordered set. Every member in the cluster returns the 'members' in the same order. To obtain the oldest member (the master) in the cluster, you can retrieve the first item in the set using 'getMembers().iterator().next()'.
getMembers
in interface Cluster
public Member getLocalMember()
Cluster
getLocalMember
in interface Cluster
public long getClusterTime()
Cluster
Cluster tries to keep a cluster-wide time which might be different than the member's own system time. Cluster-wide time is -almost- the same on all members of the cluster.
getClusterTime
in interface Cluster
Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.