Membership event fired when a new member is added to the cluster and/or when a member leaves the cluster. More...
#include <MembershipEvent.h>
Public Types | |
enum | MembershipEventType { MEMBER_ADDED = 1, MEMBER_REMOVED = 2 } |
MembershipEventType. More... | |
Public Member Functions | |
MembershipEvent (Cluster &cluster, const Member &member, MembershipEventType eventType, const std::vector< Member > &membersList) | |
Internal API. More... | |
virtual | ~MembershipEvent () |
Destructor. | |
virtual const std::vector< Member > | getMembers () const |
Returns a consistent view of the the members exactly after this MembershipEvent has been processed. More... | |
virtual const Cluster & | getCluster () const |
Returns the cluster of the event. More... | |
virtual MembershipEventType | getEventType () const |
Returns the membership event type; MembershipEvent::MEMBER_ADDED , MembershipEvent::MEMBER_REMOVED and MembershipEvent::MEMBER_ATTRIBUTE_CHANGED. More... | |
virtual const Member & | getMember () const |
Returns the removed or added member. More... | |
Membership event fired when a new member is added to the cluster and/or when a member leaves the cluster.
MembershipEventType.
MEMBER_ADDED = 1, MEMBER_REMOVED = 2,
hazelcast::client::MembershipEvent::MembershipEvent | ( | Cluster & | cluster, |
const Member & | member, | ||
MembershipEventType | eventType, | ||
const std::vector< Member > & | membersList | ||
) |
Internal API.
Constructor.
|
virtual |
Returns the cluster of the event.
|
virtual |
Returns the membership event type; MembershipEvent::MEMBER_ADDED , MembershipEvent::MEMBER_REMOVED and MembershipEvent::MEMBER_ATTRIBUTE_CHANGED.
|
virtual |
Returns the removed or added member.
|
virtual |
Returns a consistent view of the the members exactly after this MembershipEvent has been processed.
So if a member is removed, the returned set will not include this member. And if a member is added it will include this member.
The problem with calling the Cluster::getMembers() is that the content could already have changed while processing this event so it becomes very difficult to write a deterministic algorithm since you can't get a deterministic view of the members. This method solves that problem.
The set is immutable and ordered. For more information see Cluster::getMembers().