3 #include <Poco/Random.h>
4 #include <Poco/Timespan.h>
6 #include "util/BackOff.h"
20 static const uint32_t RANDOM_SEED;
23 const Poco::Timespan &min,
24 const Poco::Timespan &max,
35 Poco::Timespan
next()
override;
41 void reset()
override;
44 const Poco::Timespan m_min;
45 const Poco::Timespan m_max;
49 Poco::Random m_random;
60 void setMin(
const Poco::Timespan &min);
61 void setMax(
const Poco::Timespan &max);
62 void setCount(
int count);
63 void setSeed(
int seed);
67 BackOff::Ptr
create()
override;
BackOff::Ptr create() override
Definition: RandomBackOff.cpp:98
Poco::Timespan next() override
Generates up to count of random delays. If the count is set to 0, it is treated as inifinity...
Definition: RandomBackOff.cpp:39
Back-off policy that generates random delays in range between the given min and max. The random generation can be explicitly seeded for deterministic results (otherwise, it is seeded from the system's entropy pool). The RandomBackOff generates the specified number of random delays or inifinite based on the property count.
Definition: RandomBackOff.h:18
RandomBackOffFactory creates a preconfigured instances of class RandomBackOff.
Definition: RandomBackOff.h:56
Factory for creation of preconfigured BackOff instances.
Definition: BackOff.h:37
void reset() override
Re-seed and clear the number of available iterations to zero.
Definition: RandomBackOff.cpp:51
Back-off policy for retrying an operation.
Definition: BackOff.h:11