xrpld
Loading...
Searching...
No Matches
LoadManager.h
1#pragma once
2
3#include <xrpl/beast/utility/Journal.h>
4
5#include <chrono>
6#include <condition_variable>
7#include <memory>
8#include <mutex>
9#include <thread>
10
11namespace xrpl {
12
13class Application;
14
28{
30
31public:
32 LoadManager() = delete;
33 LoadManager(LoadManager const&) = delete;
35 operator=(LoadManager const&) = delete;
36
43
53 // VFALCO NOTE it seems that the stall detector has an "armed" state
54 // to prevent it from going off during program startup if
55 // there's a lengthy initialization operation taking place?
56 //
57 void
59
66 void
67 heartbeat();
68
69 //--------------------------------------------------------------------------
70
71 void
72 start();
73
74 void
75 stop();
76
77private:
78 void
79 run();
80
81private:
84
86 std::mutex mutex_; // Guards lastHeartbeat_, armed_, cv_
88 bool stop_ = false;
89
90 // Detect server stalls
91 std::chrono::steady_clock::time_point lastHeartbeat_;
92 bool armed_;
93
96};
97
100
101} // namespace xrpl
A generic endpoint for log messages.
Definition Journal.h:44
LoadManager(Application &app, beast::Journal journal)
std::chrono::steady_clock::time_point lastHeartbeat_
Definition LoadManager.h:91
std::condition_variable cv_
Definition LoadManager.h:87
LoadManager(LoadManager const &)=delete
beast::Journal const journal_
Definition LoadManager.h:83
friend std::unique_ptr< LoadManager > makeLoadManager(Application &app, beast::Journal journal)
std::thread thread_
Definition LoadManager.h:85
LoadManager & operator=(LoadManager const &)=delete
~LoadManager()
Destroy the manager.
std::mutex mutex_
Definition LoadManager.h:86
void heartbeat()
Reset the stall detection timer.
void activateStallDetector()
Turn on stall detection.
LoadManager()=delete
Application & app_
Definition LoadManager.h:82
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
std::unique_ptr< LoadManager > makeLoadManager(Application &app, beast::Journal journal)