Hazelcast C++ Client
Public Types | Public Member Functions | List of all members
hazelcast::client::MembershipEvent Class Reference

Membership event fired when a new member is added to the cluster and/or when a member leaves the cluster. More...

#include <MembershipEvent.h>

+ Inheritance diagram for hazelcast::client::MembershipEvent:

Public Types

enum  MembershipEventType { MEMBER_ADDED = 1, MEMBER_REMOVED = 2, MEMBER_ATTRIBUTE_CHANGED = 5 }
 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< MembergetMembers () const
 Returns a consistent view of the the members exactly after this MembershipEvent has been processed. More...
 
virtual const ClustergetCluster () 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 MembergetMember () const
 Returns the removed or added member. More...
 

Detailed Description

Membership event fired when a new member is added to the cluster and/or when a member leaves the cluster.

See also
MembershipListener

Member Enumeration Documentation

◆ MembershipEventType

MembershipEventType.

MEMBER_ADDED = 1, MEMBER_REMOVED = 2,

Constructor & Destructor Documentation

◆ MembershipEvent()

hazelcast::client::MembershipEvent::MembershipEvent ( Cluster cluster,
const Member member,
MembershipEventType  eventType,
const std::vector< Member > &  membersList 
)

Internal API.

Constructor.

Member Function Documentation

◆ getCluster()

const Cluster & hazelcast::client::MembershipEvent::getCluster ( ) const
virtual

Returns the cluster of the event.

Returns

◆ getEventType()

MembershipEvent::MembershipEventType hazelcast::client::MembershipEvent::getEventType ( ) const
virtual

Returns the membership event type; MembershipEvent::MEMBER_ADDED , MembershipEvent::MEMBER_REMOVED and MembershipEvent::MEMBER_ATTRIBUTE_CHANGED.

Returns
the membership event type

◆ getMember()

const Member & hazelcast::client::MembershipEvent::getMember ( ) const
virtual

Returns the removed or added member.

Returns
member which is removed/added

◆ getMembers()

const std::vector< Member > hazelcast::client::MembershipEvent::getMembers ( ) const
virtual

Returns a consistent view of the the members exactly after this MembershipEvent has been processed.

So if a member is removed, the returned vector 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 vector is immutable and ordered. For more information see Cluster::getMembers().

Returns
the members at the moment after this event.

The documentation for this class was generated from the following files: