51 std::shared_ptr<logging::Logger> logger,
63 "The maximum waiting time must be longer than of equal to the "
64 "initial waiting time.");
74 template <
typename Function>
79 "Failed to connect to all URIs, so retry after {:.3f} seconds.",
80 std::chrono::duration_cast<std::chrono::duration<double>>(wait_time)
83 timer_.async_sleep_for(wait_time, std::forward<Function>(function));
133 std::uniform_int_distribution<std::chrono::nanoseconds::rep>
std::shared_ptr< logging::Logger > logger_
Logger.
executors::Timer timer_
Timer.
std::chrono::nanoseconds max_waiting_time_
Maximum waiting time.
void reset()
Reset the waiting time.
std::uniform_int_distribution< std::chrono::nanoseconds::rep > jitter_time_dist_
Distribution of jitter time.
std::chrono::nanoseconds compute_waiting_time()
Compute the waiting time.
std::chrono::nanoseconds initial_waiting_time_
Initial waiting time.
std::chrono::nanoseconds next_wait_time_without_jitter_
Next waiting time without jitter.
void async_wait(Function &&function)
Asynchronously wait until the next reconnection.
std::mt19937 random_
Random number generator.
ReconnectionTimer(const std::shared_ptr< executors::IExecutor > &executor, std::shared_ptr< logging::Logger > logger, const config::ReconnectionConfig &config)
Constructor.
void cancel()
Cancel this timer.
Class of exceptions in cpp-msgpack-rpc library.
Class of configurations of reconnection.
Class of timers to call functions later.
Definition of IExecutor class.
Definition of Logger class.
#define MSGPACK_RPC_WARN(LOGGER_PTR,...)
Write a warning log.
Definition of MsgpackRPCException class.
Namespace of internal implementations.
Namespace of configurations.
Namespace of executors to process asynchronous tasks.
Definition of OperationType enumeration.
Definition of ReconnectionConfig class.
Definition of StatusCode enumeration.
Definition of Timer class.