-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExceptionMulticastBase.cpp
More file actions
50 lines (37 loc) · 1.39 KB
/
Copy pathExceptionMulticastBase.cpp
File metadata and controls
50 lines (37 loc) · 1.39 KB
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
47
48
49
#include "MicroMiddleware/Interfaces/ExceptionMulticastBase.h"
#include "MicroMiddleware/CommonDefines.h"
#include "MicroMiddleware/MiddlewareSettings.h"
namespace MicroMiddleware
{
ExceptionMulticast* ExceptionMulticast::exceptionMulticast = NULL;
InterfaceHandle ExceptionMulticast::multicastHandle = InterfaceHandle(MiddlewareSettings::GetExceptionMulticastPort(), "237.3.4.101");
ExceptionMulticast::ExceptionMulticast()
: exceptionPublisher( new ExceptionMulticastPublisher(ExceptionMulticast::multicastHandle, true) )
{
}
ExceptionMulticast::~ExceptionMulticast()
{
if(exceptionPublisher)
{
delete exceptionPublisher;
exceptionPublisher = NULL;
}
}
ExceptionMulticast* ExceptionMulticast::GetExceptionMulticast()
{
if(ExceptionMulticast::exceptionMulticast == NULL)
ExceptionMulticast::exceptionMulticast = new ExceptionMulticast();
return ExceptionMulticast::exceptionMulticast;
}
void ExceptionMulticast::PostException(const std::string &message, MiddlewareException::ExceptionDescription exceptionDescription)
{
ExceptionMulticast *ex = ExceptionMulticast::GetExceptionMulticast();
if(ex == NULL) return;
HostInformation hostInfo = Runtime::GetHostInformation();
if(!hostInfo.GetComponentName().empty())
{
ExceptionMessage exMsg(hostInfo, message, GetTimeStamp(), exceptionDescription);
ex->GetExceptionPublisher()->PostException(exMsg);
}
}
} // namespace MicroMiddleware