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