Hazelcast C++ Client
 All Classes Functions Variables Enumerations Pages
Public Member Functions | List of all members
hazelcast::client::ClientConfig Class Reference

HazelcastClient configuration class. More...

#include <ClientConfig.h>

Public Member Functions

 ClientConfig ()
 Constructor with default values. More...
 
ClientConfigaddAddress (const Address &address)
 Adds an address to list of the initial addresses. More...
 
ClientConfigaddAddresses (const std::vector< Address > &addresses)
 Adds all address in given vector to list of the initial addresses. More...
 
std::set< Address,
addressComparator > & 
getAddresses ()
 Returns set of the initial addresses. More...
 
ClientConfigsetGroupConfig (GroupConfig &groupConfig)
 The Group Configuration properties like: Name and Password that is used to connect to the cluster. More...
 
GroupConfiggetGroupConfig ()
 
ClientConfigsetCredentials (Credentials *credentials)
 Can be used instead of GroupConfig in Hazelcast Extensions. More...
 
const CredentialsgetCredentials ()
 Can be used instead of GroupConfig in Hazelcast Extensions.
 
ClientConfigsetConnectionAttemptLimit (int connectionAttemptLimit)
 While client is trying to connect initially to one of the members in the ClientConfig::addressList, all might be not available. More...
 
int getConnectionAttemptLimit () const
 While client is trying to connect initially to one of the members in the ClientConfig::addressList, all might be not available. More...
 
ClientConfigsetConnectionTimeout (int connectionTimeoutInMillis)
 
int getConnectionTimeout () const
 Timeout value for nodes to accept client connection requests. More...
 
ClientConfigsetAttemptPeriod (int attemptPeriodInMillis)
 Period for the next attempt to find a member to connect. More...
 
int getAttemptPeriod () const
 Period for the next attempt to find a member to connect. More...
 
ClientConfigsetRedoOperation (bool redoOperation)
 If true, client will redo the operations that were executing on the server and client lost the connection. More...
 
bool isRedoOperation () const
 see setRedoOperation returns redoOperation
 
bool isSmart () const
 
ClientConfigsetSmart (bool smart)
 If true, client will route the key based operations to owner of the key at the best effort. More...
 
ClientConfigsetSocketInterceptor (SocketInterceptor *socketInterceptor)
 Will be called with the Socket, each time client creates a connection to any Member. More...
 
SocketInterceptorgetSocketInterceptor ()
 Will be called with the Socket, each time client creates a connection to any Member.
 
ClientConfigaddListener (LifecycleListener *listener)
 Adds a listener to configuration to be registered when HazelcastClient starts. More...
 
const std::set
< LifecycleListener * > & 
getLifecycleListeners () const
 
ClientConfigaddListener (MembershipListener *listener)
 Adds a listener to configuration to be registered when HazelcastClient starts. More...
 
const std::set
< MembershipListener * > & 
getMembershipListeners () const
 Returns registered membershipListeners. More...
 
ClientConfigaddListener (InitialMembershipListener *listener)
 Adds a listener to configuration to be registered when HazelcastClient starts. More...
 
const std::set
< InitialMembershipListener * > & 
getInitialMembershipListeners () const
 Returns registered initialMembershipListeners. More...
 
LoadBalancer *const getLoadBalancer ()
 Used to distribute the operations to multiple Endpoints. More...
 
ClientConfigsetLoadBalancer (LoadBalancer *loadBalancer)
 Used to distribute the operations to multiple Endpoints. More...
 
ClientConfigsetLogLevel (LogLevel loggerLevel)
 enum LogLevel { SEVERE = 100, WARNING = 90, INFO = 50 }; set INFO to see every log. More...
 
SerializationConfig const & getSerializationConfig () const
 
ClientConfigsetSerializationConfig (SerializationConfig const &serializationConfig)
 SerializationConfig is used to. More...
 
std::map< std::string,
std::string > & 
getProperties ()
 Gets a reference to properties map. More...
 
ClientConfigsetProperty (const std::string &name, const std::string &value)
 Sets the value of a named property. More...
 

Detailed Description

HazelcastClient configuration class.

Constructor & Destructor Documentation

hazelcast::client::ClientConfig::ClientConfig ( )

Constructor with default values.

smart(true) redoOperation(false) connectionTimeout(60000) connectionAttemptLimit(2) attemptPeriod(3000) defaultLoadBalancer(impl::RoundRobinLB)

Member Function Documentation

ClientConfig & hazelcast::client::ClientConfig::addAddress ( const Address address)

Adds an address to list of the initial addresses.

Client will use this list to find a running Member, connect to it.

Parameters
address
Returns
itself ClientConfig
ClientConfig & hazelcast::client::ClientConfig::addAddresses ( const std::vector< Address > &  addresses)

Adds all address in given vector to list of the initial addresses.

Client will use this list to find a running Member, connect to it.

Parameters
addressesvector of addresses
Returns
itself ClientConfig
ClientConfig & hazelcast::client::ClientConfig::addListener ( LifecycleListener listener)

Adds a listener to configuration to be registered when HazelcastClient starts.

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
listenerLifecycleListener *listener
Returns
itself ClientConfig
ClientConfig & hazelcast::client::ClientConfig::addListener ( MembershipListener listener)

Adds a listener to configuration to be registered when HazelcastClient starts.

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 *listener
Returns
itself ClientConfig
ClientConfig & hazelcast::client::ClientConfig::addListener ( InitialMembershipListener listener)

Adds a listener to configuration to be registered when HazelcastClient starts.

Parameters
listenerInitialMembershipListener *listener
Returns
itself ClientConfig
std::set< Address, addressComparator > & hazelcast::client::ClientConfig::getAddresses ( )

Returns set of the initial addresses.

Client will use this vector to find a running Member, connect to it.

Returns
vector of addresses
int hazelcast::client::ClientConfig::getAttemptPeriod ( ) const

Period for the next attempt to find a member to connect.

(see ClientConfig::connectionAttemptLimit ).

Returns
int attemptPeriodInMillis
int hazelcast::client::ClientConfig::getConnectionAttemptLimit ( ) const

While client is trying to connect initially to one of the members in the ClientConfig::addressList, all might be not available.

Instead of giving up, throwing Exception and stopping client, it will attempt to retry as much as ClientConfig::connectionAttemptLimit times.

return int connectionAttemptLimit

int hazelcast::client::ClientConfig::getConnectionTimeout ( ) const

Timeout value for nodes to accept client connection requests.

Returns
int connectionTimeoutInMillis
GroupConfig & hazelcast::client::ClientConfig::getGroupConfig ( )
Returns
groupConfig
const std::set< InitialMembershipListener * > & hazelcast::client::ClientConfig::getInitialMembershipListeners ( ) const

Returns registered initialMembershipListeners.

Returns
registered initialMembershipListeners
const std::set< LifecycleListener * > & hazelcast::client::ClientConfig::getLifecycleListeners ( ) const
Returns
registered lifecycleListeners
LoadBalancer *const hazelcast::client::ClientConfig::getLoadBalancer ( )

Used to distribute the operations to multiple Endpoints.

Returns
loadBalancer
const std::set< MembershipListener * > & hazelcast::client::ClientConfig::getMembershipListeners ( ) const

Returns registered membershipListeners.

Returns
registered membershipListeners
std::map< std::string, std::string > & hazelcast::client::ClientConfig::getProperties ( )

Gets a reference to properties map.

Returns
properties map
SerializationConfig const & hazelcast::client::ClientConfig::getSerializationConfig ( ) const
Returns
serializationConfig
bool hazelcast::client::ClientConfig::isSmart ( ) const
Returns
true if client configured as smart see setSmart()
ClientConfig & hazelcast::client::ClientConfig::setAttemptPeriod ( int  attemptPeriodInMillis)

Period for the next attempt to find a member to connect.

(see ClientConfig::connectionAttemptLimit ).

Parameters
attemptPeriodInMillis
Returns
itself ClientConfig
ClientConfig & hazelcast::client::ClientConfig::setConnectionAttemptLimit ( int  connectionAttemptLimit)

While client is trying to connect initially to one of the members in the ClientConfig::addressList, all might be not available.

Instead of giving up, throwing Exception and stopping client, it will attempt to retry as much as ClientConfig::connectionAttemptLimit times.

Parameters
connectionAttemptLimit
Returns
itself ClientConfig
ClientConfig & hazelcast::client::ClientConfig::setConnectionTimeout ( int  connectionTimeoutInMillis)
Parameters
connectionTimeoutTimeout value in millis for nodes to accept client connection requests. A zero value means wait until connection established or an error occurs.
Returns
itself ClientConfig
ClientConfig & hazelcast::client::ClientConfig::setCredentials ( Credentials credentials)

Can be used instead of GroupConfig in Hazelcast Extensions.

Returns
itself ClientConfig
ClientConfig & hazelcast::client::ClientConfig::setGroupConfig ( GroupConfig groupConfig)

The Group Configuration properties like: Name and Password that is used to connect to the cluster.

Parameters
groupConfig
Returns
itself ClientConfig
ClientConfig & hazelcast::client::ClientConfig::setLoadBalancer ( LoadBalancer loadBalancer)

Used to distribute the operations to multiple Endpoints.

If not set, RoundRobin based load balancer is used

Parameters
loadBalancer
Returns
itself ClientConfig
ClientConfig & hazelcast::client::ClientConfig::setLogLevel ( LogLevel  loggerLevel)

enum LogLevel { SEVERE = 100, WARNING = 90, INFO = 50 }; set INFO to see every log.

set WARNING to see only possible warnings and serious errors. set SEVERE to see only serious errors

Default log level is INFO

Returns
itself ClientConfig
ClientConfig & hazelcast::client::ClientConfig::setProperty ( const std::string &  name,
const std::string &  value 
)

Sets the value of a named property.

See Also
ClientProperties for properties that is used to configure client
Parameters
nameproperty name
valuevalue of the property
Returns
itself ClientConfig
ClientConfig & hazelcast::client::ClientConfig::setRedoOperation ( bool  redoOperation)

If true, client will redo the operations that were executing on the server and client lost the connection.

This can be because of network, or simply because the member died. However it is not clear whether the application is performed or not. For idempotent operations this is harmless, but for non idempotent ones retrying can cause to undesirable effects. Note that the redo can perform on any member.

If false, the operation will throw IOException.

Parameters
redoOperationreturn itself ClientConfig
ClientConfig & hazelcast::client::ClientConfig::setSerializationConfig ( SerializationConfig const &  serializationConfig)

SerializationConfig is used to.

ClientConfig & hazelcast::client::ClientConfig::setSmart ( bool  smart)

If true, client will route the key based operations to owner of the key at the best effort.

Note that it uses a cached version of PartitionService::getPartitions() and doesn't guarantee that the operation will always be executed on the owner. The cached table is updated every 10 seconds.

Parameters
smart
Returns
itself ClientConfig
ClientConfig & hazelcast::client::ClientConfig::setSocketInterceptor ( SocketInterceptor socketInterceptor)

Will be called with the Socket, each time client creates a connection to any Member.

Returns
itself ClientConfig

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