mirror of https://github.com/Icinga/icinga2.git
parent
5f54406057
commit
4563bb355f
|
@ -150,9 +150,24 @@ void DynamicObject::Register(void)
|
|||
void DynamicObject::Start(void)
|
||||
{
|
||||
ASSERT(!OwnsLock());
|
||||
ObjectLock olock(this);
|
||||
|
||||
SetStartCalled(true);
|
||||
}
|
||||
|
||||
void DynamicObject::Activate(void)
|
||||
{
|
||||
ASSERT(!OwnsLock());
|
||||
|
||||
Start();
|
||||
|
||||
ASSERT(GetStartCalled());
|
||||
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
ASSERT(!IsActive());
|
||||
SetActive(true);
|
||||
}
|
||||
|
||||
OnStarted(GetSelf());
|
||||
}
|
||||
|
@ -160,9 +175,27 @@ void DynamicObject::Start(void)
|
|||
void DynamicObject::Stop(void)
|
||||
{
|
||||
ASSERT(!OwnsLock());
|
||||
ObjectLock olock(this);
|
||||
|
||||
SetStopCalled(true);
|
||||
}
|
||||
|
||||
void DynamicObject::Deactivate(void)
|
||||
{
|
||||
ASSERT(!OwnsLock());
|
||||
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
||||
if (!IsActive())
|
||||
return;
|
||||
|
||||
ASSERT(IsActive());
|
||||
SetActive(false);
|
||||
}
|
||||
|
||||
Stop();
|
||||
|
||||
ASSERT(GetStopCalled());
|
||||
|
||||
OnStopped(GetSelf());
|
||||
}
|
||||
|
@ -299,8 +332,7 @@ void DynamicObject::StopObjects(void)
|
|||
{
|
||||
BOOST_FOREACH(const DynamicType::Ptr& dt, DynamicType::GetTypes()) {
|
||||
BOOST_FOREACH(const DynamicObject::Ptr& object, dt->GetObjects()) {
|
||||
if (object->IsActive())
|
||||
object->Stop();
|
||||
object->Deactivate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@ abstract class DynamicObject
|
|||
[config] Array::Ptr domains;
|
||||
[config] Array::Ptr authorities;
|
||||
[get_protected] bool active;
|
||||
[get_protected] bool start_called;
|
||||
[get_protected] bool stop_called;
|
||||
Dictionary::Ptr authority_info;
|
||||
[protected] Dictionary::Ptr extensions;
|
||||
};
|
||||
|
|
|
@ -337,7 +337,7 @@ bool ConfigItem::ActivateItems(bool validateOnly)
|
|||
#ifdef _DEBUG
|
||||
Log(LogDebug, "config", "Activating object '" + object->GetName() + "' of type '" + object->GetType()->GetName() + "'");
|
||||
#endif /* _DEBUG */
|
||||
upq.Enqueue(boost::bind(&DynamicObject::Start, object));
|
||||
upq.Enqueue(boost::bind(&DynamicObject::Activate, object));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue