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

Hazelcast cluster interface. More...

#include <Cluster.h>

Public Member Functions

 Cluster (spi::ClientClusterService &clusterService)
 Constructor.
 
void addMembershipListener (MembershipListener *listener)
 
std::string addMembershipListener (const boost::shared_ptr< MembershipListener > &listener)
 Adds MembershipListener to listen for membership updates. More...
 
std::string addMembershipListener (InitialMembershipListener *listener)
 
std::string addMembershipListener (const boost::shared_ptr< InitialMembershipListener > &listener)
 Adds MembershipListener to listen for membership updates. More...
 
bool removeMembershipListener (MembershipListener *listener)
 
bool removeMembershipListener (const std::string &registrationId)
 Removes the specified MembershipListener. More...
 
std::vector< MembergetMembers ()
 Set of current members of the cluster. More...
 

Detailed Description

Hazelcast cluster interface.

Member Function Documentation

◆ addMembershipListener() [1/4]

void hazelcast::client::Cluster::addMembershipListener ( MembershipListener listener)
Deprecated:
Please use addMembershipListener(const boost::shared_ptr<MembershipListener> &)

Adds MembershipListener to listen for membership updates.

Warning 1: If listener should do a time consuming operation, off-load the operation to another thread. otherwise it will slow down the system.

Warning 2: Do not make a call to hazelcast. It can cause deadlock.

Parameters
listenerMembershipListener

◆ addMembershipListener() [2/4]

std::string hazelcast::client::Cluster::addMembershipListener ( const boost::shared_ptr< MembershipListener > &  listener)

Adds MembershipListener to listen for membership updates.

The addMembershipListener method returns a register ID. This ID is needed to remove the MembershipListener using the 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.

Parameters
listenermembership listener
Returns
the registration ID
Exceptions
NullPointerExceptionif listener is null
See also
removeMembershipListener(const std::string &)

◆ addMembershipListener() [3/4]

std::string hazelcast::client::Cluster::addMembershipListener ( InitialMembershipListener listener)
Deprecated:
Please use addMembershipListener(const boost::shared_ptr<InitialMembershipListener> &)

Adds InitialMembershipListener to listen for membership updates.

Warning 1: If listener should do a time consuming operation, off-load the operation to another thread. otherwise it will slow down the system.

Warning 2: Do not make a call to hazelcast. It can cause deadlock.

Parameters
listenerInitialMembershipListener
Returns
the registration ID

◆ addMembershipListener() [4/4]

std::string hazelcast::client::Cluster::addMembershipListener ( const boost::shared_ptr< InitialMembershipListener > &  listener)

Adds MembershipListener to listen for membership updates.

The addMembershipListener method returns a register ID. This ID is needed to remove the MembershipListener using the 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.

Parameters
listenermembership listener
Returns
the registration ID
Exceptions
NullPointerExceptionif listener is null
See also
removeMembershipListener(const std::string &)

◆ getMembers()

std::vector< Member > hazelcast::client::Cluster::getMembers ( )

Set of current members of the cluster.

Returning set instance is not modifiable. Every member in the cluster has the same member list in the same order. First member is the oldest member.

Returns
current members of the cluster

◆ removeMembershipListener() [1/2]

bool hazelcast::client::Cluster::removeMembershipListener ( MembershipListener listener)
Deprecated:
Please use removeMembershipListener(const std::string &)

Removes the specified membership listener.

Parameters
listenerMembershipListener * to be removed
Returns
true if registration is removed, false otherwise

◆ removeMembershipListener() [2/2]

bool hazelcast::client::Cluster::removeMembershipListener ( const std::string &  registrationId)

Removes the specified MembershipListener.

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.

Parameters
registrationIdthe registrationId of MembershipListener to remove
Returns
true if the registration is removed, false otherwise
See also
addMembershipListener(const boost::shared_ptr<MembershipListener> &)

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