Hazelcast C++ Client
 All Classes Functions Variables Enumerations Pages
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 }
 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.

MEMBER_ADDED = 1, MEMBER_REMOVED = 2,

Constructor & Destructor Documentation

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

Internal API.

Constructor.

Member Function Documentation

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

Returns the cluster of the event.

Returns
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
const Member & hazelcast::client::MembershipEvent::getMember ( ) const
virtual

Returns the removed or added member.

Returns
member which is removed/added
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 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().

Returns
the members at the moment after this event.

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