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