3 #include <Poco/Clock.h>
4 #include <Poco/Random.h>
6 #include "util/BackOff.h"
34 typedef Poco::SharedPtr<ExponentialBackOff> Ptr;
40 void setInitialInterval(
const Poco::Timespan &interval);
41 Poco::Timespan initialInterval()
const;
43 void setMaxInterval(
const Poco::Timespan &interval);
44 Poco::Timespan maxInterval()
const;
46 void setMaxElapsedTime(
const Poco::Timespan &time);
47 Poco::Timespan maxElapsedTime()
const;
49 void setRandomizationFactor(
double factor);
50 double randomizationFactor()
const;
52 void setMultiplier(
double multiplier);
53 double multiplier()
const;
56 Poco::Timespan m_initialInterval;
57 Poco::Timespan m_maxInterval;
58 Poco::Timespan m_maxElapsedTime;
59 double m_randomizationFactor;
65 void applyConfig(
const Config &config);
66 const Config &config()
const;
68 Poco::Timespan initialInterval()
const;
69 Poco::Timespan maxInterval()
const;
70 Poco::Timespan maxElapsedTime()
const;
71 double randomizationFactor()
const;
72 double multiplier()
const;
85 Poco::Timespan
next()
override;
86 void reset()
override;
89 Poco::Timespan nextRandom();
94 Poco::Timespan m_nextInterval;
95 Poco::Clock m_resetStamp;
96 Poco::Random m_random;
101 BackOff::Ptr
create()
override;
103 void setInitialInterval(
const Poco::Timespan &interval);
104 void setMaxInterval(
const Poco::Timespan &interval);
105 void setMaxElapsedTime(
const Poco::Timespan &time);
106 void setRandomizationFactor(
double factor);
107 void setMultiplier(
double multiplier);
Definition: ExponentialBackOff.h:99
Definition: ExponentialBackOff.h:36
Poco::Timespan nextInterval() const
Definition: ExponentialBackOff.cpp:132
Poco::Timespan elapsed() const
Definition: ExponentialBackOff.cpp:137
ExponentialBackOff implements the computation of delay when retrying an operation. It is usually used to lower load of a server.
Definition: ExponentialBackOff.h:32
Factory for creation of preconfigured BackOff instances.
Definition: BackOff.h:37
Poco::Timespan next() override
Definition: ExponentialBackOff.cpp:142
Back-off policy for retrying an operation.
Definition: BackOff.h:11
void reset() override
Definition: ExponentialBackOff.cpp:170
BackOff::Ptr create() override
Definition: ExponentialBackOff.cpp:177