AMPS C/C++ Client Class Reference
AMPS C/C++ Client Version 5.3.4.3
|
ExponentialDelayStrategy is an implementation that exponentially "backs off" when reconnecting to the same server, with a maximum number of retries before it gives up entirely. More...
#include <ReconnectDelayStrategyImpl.hpp>
Public Member Functions | |
ExponentialDelayStrategy (unsigned int initialDelay_=200, unsigned int maximumDelay_=20 *1000, double backoffExponent_=2.0, unsigned int maximumRetryTime_=0, double jitter_=1.0) | |
Constructs an exponential delay strategy, the default strategy for HAClient. More... | |
unsigned int | getConnectWaitDuration (const std::string &uri_) |
Returns the time that the client should delay before connecting to the given server URI. More... | |
void | reset (void) |
Reset the state of this reconnect delay. More... | |
ExponentialDelayStrategy is an implementation that exponentially "backs off" when reconnecting to the same server, with a maximum number of retries before it gives up entirely.
|
inline |
Constructs an exponential delay strategy, the default strategy for HAClient.
initialDelay_ | The time (in milliseconds) to wait before reconnecting to a server for the first time after a failed connection attempt. |
maximumDelay_ | The maximum time to wait for any reconnect attempt (milliseconds). Exponential backoff will not exceed this maximum. |
backoffExponent_ | The exponent to use for calculating the next delay time. For example, if the initial time is 200ms and the exponent is 2.0, the next delay will be 400ms, then 800ms, etc. |
maximumRetryTime_ | The maximum time (milliseconds) to allow reconnect attempts to continue without a successful connection, before "giving up" and abandoning the connection attempt. |
jitter_ | The amount of 'jitter' to apply when calculating a delay time, measured in multiples of the initial delay. Jitter is used to reduce the number of simultaneous reconnects that may be issued from multiple clients. |
|
inlinevirtual |
Returns the time that the client should delay before connecting to the given server URI.
uri_ | The URI which the client plans to connect. |
Any | exception thrown indicates no connection should be attempted; the client should in essence "give up." |
Implements AMPS::ReconnectDelayStrategyImpl.
|
inlinevirtual |
Reset the state of this reconnect delay.
AMPS calls this method when a connection is successfully established.
Implements AMPS::ReconnectDelayStrategyImpl.