Hazelcast C++ Client
Hazelcast C++ Client Library
Loading...
Searching...
No Matches
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
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.
connection_retry_configset_max_backoff_duration (std::chrono::milliseconds max_backoff_duration)
 When backoff reaches this upper bound, it does not increase any more.
double get_multiplier () const
 factor with which to multiply backoff time after a failed retry
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.
connection_retry_configset_cluster_connect_timeout (std::chrono::milliseconds cluster_connect_timeout)
double get_jitter () const
 by how much to randomize backoffs.
connection_retry_configset_jitter (double jitter)
 At each iteration calculated back-off is randomized via following method random(-jitter * current_backoff, jitter * current_backoff)

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 35 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 288 of file config.cpp.

289{
290 return cluster_connect_timeout_;
291}

◆ 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 240 of file config.cpp.

241{
242 return initial_backoff_duration_;
243}

◆ 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 305 of file config.cpp.

306{
307 return jitter_;
308}

◆ 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 257 of file config.cpp.

258{
259 return max_backoff_duration_;
260}

◆ 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 273 of file config.cpp.

274{
275 return multiplier_;
276}

◆ 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 294 of file config.cpp.

296{
297 util::Preconditions::check_not_negative(
298 cluster_connect_timeout.count(),
299 "Cluster connect timeout must be non-negative!");
300 cluster_connect_timeout_ = cluster_connect_timeout;
301 return *this;
302}

◆ 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 246 of file config.cpp.

248{
249 util::Preconditions::check_not_negative(
250 initial_backoff_duration.count(),
251 "Initial backoff must be non-negative!");
252 initial_backoff_duration_ = initial_backoff_duration;
253 return *this;
254}

◆ 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 311 of file config.cpp.

312{
313 util::Preconditions::check_true(jitter >= 0.0 && jitter <= 1.0,
314 "Jitter must be in range [0.0, 1.0]");
315 jitter_ = jitter;
316 return *this;
317}

◆ 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 263 of file config.cpp.

265{
266 util::Preconditions::check_not_negative(
267 max_backoff_duration.count(), "Max backoff must be non-negative!");
268 max_backoff_duration_ = max_backoff_duration;
269 return *this;
270}

◆ 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 279 of file config.cpp.

280{
281 util::Preconditions::check_true(
282 m >= 1.0, "Multiplier must be greater than or equal to 1.0!");
283 multiplier_ = m;
284 return *this;
285}

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