blob: fe791e8a9b837bcea465a1358ac159b9b62013b4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
#pragma once
#include "mon_messagebus.h"
#include <library/cpp/monlib/service/monservice.h>
#include <util/system/mutex.h>
namespace NMonitoring {
class TMonServiceMessageBus: public TMonService2 {
private:
TMutex Mtx;
TIntrusivePtr<NMonitoring::TBusNgMonPage> BusNgMonPage;
public:
TMonServiceMessageBus(ui16 port, const TString& title);
private:
NBus::TBusWww* RegisterBusNgMonPage() {
TGuard<TMutex> g(Mtx);
if (!BusNgMonPage) {
BusNgMonPage = new NMonitoring::TBusNgMonPage();
Register(BusNgMonPage.Get());
}
return BusNgMonPage->BusWww.Get();
}
public:
void RegisterClientSession(NBus::TBusClientSessionPtr clientSession) {
RegisterBusNgMonPage()->RegisterClientSession(clientSession);
}
void RegisterServerSession(NBus::TBusServerSessionPtr serverSession) {
RegisterBusNgMonPage()->RegisterServerSession(serverSession);
}
void RegisterQueue(NBus::TBusMessageQueuePtr queue) {
RegisterBusNgMonPage()->RegisterQueue(queue);
}
void RegisterModule(NBus::TBusModule* module) {
RegisterBusNgMonPage()->RegisterModule(module);
}
};
}
|