Hazelcast C++ Client
Hazelcast C++ Client Library
hazelcast::client::config::connection_retry_config Class Reference

Connection Retry Config is controls the period among the retries and when should a client gave up retrying. More...

#include <connection_retry_config.h>

Public Member Functions

std::chrono::milliseconds get_initial_backoff_duration () const
 how long to wait after the first failure before retrying More...
 
connection_retry_configset_initial_backoff_duration (std::chrono::milliseconds initial_backoff_duration)
 
std::chrono::milliseconds get_max_backoff_duration () const
 When backoff reaches this upper bound, it does not increase any more. More...
 
connection_retry_configset_max_backoff_duration (std::chrono::milliseconds max_backoff_duration)
 When backoff reaches this upper bound, it does not increase any more. More...
 
double get_multiplier () const
 factor with which to multiply backoff time after a failed retry More...
 
connection_retry_configset_multiplier (double multiplier)
 
std::chrono::milliseconds get_cluster_connect_timeout () const
 Timeout value for the client to give up to connect to the current cluster Theclient can shutdown after reaching the timeout. More...
 
connection_retry_configset_cluster_connect_timeout (std::chrono::milliseconds cluster_connect_timeout)
 
double get_jitter () const
 by how much to randomize backoffs. More...
 
connection_retry_configset_jitter (double jitter)
 At each iteration calculated back-off is randomized via following method random(-jitter * current_backoff, jitter * current_backoff) More...
 

Detailed Description

Connection Retry Config is controls the period among the retries and when should a client gave up retrying.

Exponential behaviour can be chosen or jitter can be added to wait periods.

Definition at line 34 of file connection_retry_config.h.

Member Function Documentation

◆ get_cluster_connect_timeout()

std::chrono::milliseconds hazelcast::client::config::connection_retry_config::get_cluster_connect_timeout ( ) const

Timeout value for the client to give up to connect to the current cluster Theclient can shutdown after reaching the timeout.

Returns
cluster_connect_timeout_

Definition at line 233 of file config.cpp.

233  {
234  return cluster_connect_timeout_;
235  }

◆ get_initial_backoff_duration()

std::chrono::milliseconds hazelcast::client::config::connection_retry_config::get_initial_backoff_duration ( ) const

how long to wait after the first failure before retrying

Returns
initial_backoff_duration_

Definition at line 199 of file config.cpp.

199  {
200  return initial_backoff_duration_;
201  }

◆ get_jitter()

double hazelcast::client::config::connection_retry_config::get_jitter ( ) const

by how much to randomize backoffs.

At each iteration calculated back-off is randomized via following method random(-jitter * current_backoff, jitter * current_backoff)

Returns
jitter_

Definition at line 245 of file config.cpp.

245  {
246  return jitter_;
247  }

◆ get_max_backoff_duration()

std::chrono::milliseconds hazelcast::client::config::connection_retry_config::get_max_backoff_duration ( ) const

When backoff reaches this upper bound, it does not increase any more.

Returns
max_backoff_duration_

Definition at line 211 of file config.cpp.

211  {
212  return max_backoff_duration_;
213  }

◆ get_multiplier()

double hazelcast::client::config::connection_retry_config::get_multiplier ( ) const

factor with which to multiply backoff time after a failed retry

Returns
multiplier_

Definition at line 223 of file config.cpp.

223  {
224  return multiplier_;
225  }

◆ set_cluster_connect_timeout()

connection_retry_config & hazelcast::client::config::connection_retry_config::set_cluster_connect_timeout ( std::chrono::milliseconds  cluster_connect_timeout)
Parameters
cluster_connect_timeouttimeout for the client to give up to connect to the current cluster The client can shutdown after reaching the timeout.
Returns
updated connection_retry_config

Definition at line 237 of file config.cpp.

238  {
239  util::Preconditions::check_not_negative(cluster_connect_timeout.count(),
240  "Cluster connect timeout must be non-negative!");
241  cluster_connect_timeout_ = cluster_connect_timeout;
242  return *this;
243  }

◆ set_initial_backoff_duration()

connection_retry_config & hazelcast::client::config::connection_retry_config::set_initial_backoff_duration ( std::chrono::milliseconds  initial_backoff_duration)
Parameters
initial_backoff_durationhow long to wait after the first failure before retrying
Returns
updated connection_retry_config

Definition at line 204 of file config.cpp.

204  {
205  util::Preconditions::check_not_negative(initial_backoff_duration.count(),
206  "Initial backoff must be non-negative!");
207  initial_backoff_duration_ = initial_backoff_duration;
208  return *this;
209  }

◆ set_jitter()

connection_retry_config & hazelcast::client::config::connection_retry_config::set_jitter ( double  jitter)

At each iteration calculated back-off is randomized via following method random(-jitter * current_backoff, jitter * current_backoff)

Parameters
jitterby how much to randomize backoffs
Returns
updated connection_retry_config

Definition at line 249 of file config.cpp.

249  {
250  util::Preconditions::check_true(jitter >= 0.0 && jitter <= 1.0, "Jitter must be in range [0.0, 1.0]");
251  jitter_ = jitter;
252  return *this;
253  }

◆ set_max_backoff_duration()

connection_retry_config & hazelcast::client::config::connection_retry_config::set_max_backoff_duration ( std::chrono::milliseconds  max_backoff_duration)

When backoff reaches this upper bound, it does not increase any more.

Parameters
max_backoff_durationupper bound on backoff
Returns
updated connection_retry_config

Definition at line 216 of file config.cpp.

216  {
217  util::Preconditions::check_not_negative(max_backoff_duration.count(),
218  "Max backoff must be non-negative!");
219  max_backoff_duration_ = max_backoff_duration;
220  return *this;
221  }

◆ set_multiplier()

connection_retry_config & hazelcast::client::config::connection_retry_config::set_multiplier ( double  multiplier)
Parameters
multiplierfactor with which to multiply backoff after a failed retry
Returns
updated connection_retry_config

Definition at line 227 of file config.cpp.

227  {
228  util::Preconditions::check_true(m >= 1.0, "Multiplier must be greater than or equal to 1.0!");
229  multiplier_ = m;
230  return *this;
231  }

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