mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-26 23:24:09 +02:00
Gracefully deactivate all dynamic objects before shutting down.
This commit is contained in:
parent
11fb9c541e
commit
21ea872651
@ -59,6 +59,8 @@ Application::~Application(void)
|
|||||||
{
|
{
|
||||||
m_ShuttingDown = true;
|
m_ShuttingDown = true;
|
||||||
|
|
||||||
|
DynamicObject::DeactivateObjects();
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
WSACleanup();
|
WSACleanup();
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
@ -442,6 +442,20 @@ void DynamicObject::RestoreObjects(const String& filename)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DynamicObject::DeactivateObjects(void)
|
||||||
|
{
|
||||||
|
DynamicObject::TypeMap::iterator tt;
|
||||||
|
for (tt = GetAllObjects().begin(); tt != GetAllObjects().end(); tt++) {
|
||||||
|
DynamicObject::NameMap::iterator nt;
|
||||||
|
|
||||||
|
while ((nt = tt->second.begin()) != tt->second.end()) {
|
||||||
|
DynamicObject::Ptr object = nt->second;
|
||||||
|
|
||||||
|
object->Unregister();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DynamicObject::TypeMap& DynamicObject::GetAllObjects(void)
|
DynamicObject::TypeMap& DynamicObject::GetAllObjects(void)
|
||||||
{
|
{
|
||||||
static TypeMap objects;
|
static TypeMap objects;
|
||||||
|
@ -116,6 +116,7 @@ public:
|
|||||||
|
|
||||||
static void DumpObjects(const String& filename);
|
static void DumpObjects(const String& filename);
|
||||||
static void RestoreObjects(const String& filename);
|
static void RestoreObjects(const String& filename);
|
||||||
|
static void DeactivateObjects(void);
|
||||||
|
|
||||||
static void RegisterClass(const String& type, Factory factory);
|
static void RegisterClass(const String& type, Factory factory);
|
||||||
static bool ClassExists(const String& type);
|
static bool ClassExists(const String& type);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user