mirror of https://github.com/Icinga/icinga2.git
parent
c63684a72f
commit
97fee26289
|
@ -443,7 +443,6 @@ void Application::InstallExceptionHandlers(void)
|
|||
* Runs the application.
|
||||
*
|
||||
* @returns The application's exit code.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
int Application::Run(void)
|
||||
{
|
||||
|
|
|
@ -38,7 +38,6 @@ Array::Array(void)
|
|||
*
|
||||
* @param index The index..
|
||||
* @returns The value.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Value Array::Get(unsigned int index) const
|
||||
{
|
||||
|
@ -53,7 +52,6 @@ Value Array::Get(unsigned int index) const
|
|||
*
|
||||
* @param index The index.
|
||||
* @param value The value.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Array::Set(unsigned int index, const Value& value)
|
||||
{
|
||||
|
@ -68,7 +66,6 @@ void Array::Set(unsigned int index, const Value& value)
|
|||
* Adds a value to the array.
|
||||
*
|
||||
* @param value The value.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Array::Add(const Value& value)
|
||||
{
|
||||
|
@ -82,6 +79,8 @@ void Array::Add(const Value& value)
|
|||
/**
|
||||
* Returns an iterator to the beginning of the array.
|
||||
*
|
||||
* Note: Caller must hold the object lock while using the iterator.
|
||||
*
|
||||
* @returns An iterator.
|
||||
*/
|
||||
Array::Iterator Array::Begin(void)
|
||||
|
@ -94,6 +93,8 @@ Array::Iterator Array::Begin(void)
|
|||
/**
|
||||
* Returns an iterator to the end of the array.
|
||||
*
|
||||
* Note: Caller must hold the object lock while using the iterator.
|
||||
*
|
||||
* @returns An iterator.
|
||||
*/
|
||||
Array::Iterator Array::End(void)
|
||||
|
@ -107,7 +108,6 @@ Array::Iterator Array::End(void)
|
|||
* Returns the number of elements in the array.
|
||||
*
|
||||
* @returns Number of elements.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
size_t Array::GetLength(void) const
|
||||
{
|
||||
|
@ -121,7 +121,6 @@ size_t Array::GetLength(void) const
|
|||
* Removes the specified index from the array.
|
||||
*
|
||||
* @param index The index.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Array::Remove(unsigned int index)
|
||||
{
|
||||
|
@ -175,7 +174,6 @@ bool Array::IsSealed(void) const
|
|||
* Makes a shallow copy of an array.
|
||||
*
|
||||
* @returns a copy of the array.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Array::Ptr Array::ShallowClone(void) const
|
||||
{
|
||||
|
@ -194,7 +192,6 @@ Array::Ptr Array::ShallowClone(void) const
|
|||
*
|
||||
* @param json The JSON object.
|
||||
* @returns An array that is equivalent to the JSON object.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Array::Ptr Array::FromJson(cJSON *json)
|
||||
{
|
||||
|
@ -217,7 +214,6 @@ Array::Ptr Array::FromJson(cJSON *json)
|
|||
*
|
||||
* @returns A JSON object that is equivalent to the array. Values that
|
||||
* cannot be represented in JSON are omitted.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
cJSON *Array::ToJson(void) const
|
||||
{
|
||||
|
|
|
@ -68,8 +68,6 @@ public:
|
|||
/**
|
||||
* Starts the async task. The caller must hold a reference to the AsyncTask
|
||||
* object until the completion callback is invoked.
|
||||
*
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Start(const CompletionCallback& completionCallback = CompletionCallback())
|
||||
{
|
||||
|
@ -82,8 +80,6 @@ public:
|
|||
|
||||
/**
|
||||
* Checks whether the task is finished.
|
||||
*
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
bool IsFinished(void) const
|
||||
{
|
||||
|
@ -97,7 +93,6 @@ public:
|
|||
* the AsyncTask object.
|
||||
*
|
||||
* @returns The task's result.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
TResult GetResult(void)
|
||||
{
|
||||
|
@ -124,7 +119,6 @@ public:
|
|||
* Finishes the task using an exception.
|
||||
*
|
||||
* @param ex The exception.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void FinishException(const boost::exception_ptr& ex)
|
||||
{
|
||||
|
@ -139,7 +133,6 @@ public:
|
|||
* Finishes the task using an ordinary result.
|
||||
*
|
||||
* @param result The result.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void FinishResult(const TResult& result)
|
||||
{
|
||||
|
@ -162,8 +155,6 @@ private:
|
|||
/**
|
||||
* Finishes the task and causes the completion callback to be invoked. This
|
||||
* function must be called before the object is destroyed.
|
||||
*
|
||||
* @threadsafety Caller must hold m_Mutex.
|
||||
*/
|
||||
void FinishInternal(void)
|
||||
{
|
||||
|
|
|
@ -28,36 +28,24 @@ AttributeBase::AttributeBase(void)
|
|||
: m_Value()
|
||||
{ }
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void AttributeBase::Set(const Value& value)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_Mutex);
|
||||
InternalSet(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Value AttributeBase::Get(void) const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_Mutex);
|
||||
return InternalGet();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
AttributeBase::operator Value(void) const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_Mutex);
|
||||
return InternalGet();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
bool AttributeBase::IsEmpty(void) const
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_Mutex);
|
||||
|
@ -65,7 +53,7 @@ bool AttributeBase::IsEmpty(void) const
|
|||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Caller must hold l_Mutex;
|
||||
* Note: Caller must hold l_Mutex;
|
||||
*/
|
||||
void AttributeBase::InternalSet(const Value& value)
|
||||
{
|
||||
|
@ -73,7 +61,7 @@ void AttributeBase::InternalSet(const Value& value)
|
|||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Caller must hold l_Mutex.
|
||||
* Note: Caller must hold l_Mutex.
|
||||
*/
|
||||
const Value& AttributeBase::InternalGet(void) const
|
||||
{
|
||||
|
|
|
@ -75,17 +75,11 @@ template<typename T>
|
|||
class Attribute : public AttributeBase
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Set(const T& value)
|
||||
{
|
||||
AttributeBase::Set(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Attribute<T>& operator=(const T& rhs)
|
||||
{
|
||||
Set(rhs);
|
||||
|
@ -102,9 +96,6 @@ public:
|
|||
return static_cast<T>(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
operator T(void) const
|
||||
{
|
||||
return Get();
|
||||
|
|
|
@ -71,7 +71,6 @@ Dictionary::Dictionary(void)
|
|||
*
|
||||
* @param key The key whose value should be retrieved.
|
||||
* @returns The value of an empty value if the key was not found.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Value Dictionary::Get(const char *key) const
|
||||
{
|
||||
|
@ -93,7 +92,6 @@ Value Dictionary::Get(const char *key) const
|
|||
*
|
||||
* @param key The key whose value should be retrieved.
|
||||
* @returns The value or an empty value if the key was not found.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Value Dictionary::Get(const String& key) const
|
||||
{
|
||||
|
@ -105,7 +103,6 @@ Value Dictionary::Get(const String& key) const
|
|||
*
|
||||
* @param key The key.
|
||||
* @param value The value.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Dictionary::Set(const String& key, const Value& value)
|
||||
{
|
||||
|
@ -128,6 +125,8 @@ void Dictionary::Set(const String& key, const Value& value)
|
|||
/**
|
||||
* Returns an iterator to the beginning of the dictionary.
|
||||
*
|
||||
* Note: Caller must hold the object lock while using the iterator.
|
||||
*
|
||||
* @returns An iterator.
|
||||
*/
|
||||
Dictionary::Iterator Dictionary::Begin(void)
|
||||
|
@ -140,6 +139,8 @@ Dictionary::Iterator Dictionary::Begin(void)
|
|||
/**
|
||||
* Returns an iterator to the end of the dictionary.
|
||||
*
|
||||
* Note: Caller must hold the object lock while using the iterator.
|
||||
*
|
||||
* @returns An iterator.
|
||||
*/
|
||||
Dictionary::Iterator Dictionary::End(void)
|
||||
|
@ -153,7 +154,6 @@ Dictionary::Iterator Dictionary::End(void)
|
|||
* Returns the number of elements in the dictionary.
|
||||
*
|
||||
* @returns Number of elements.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
size_t Dictionary::GetLength(void) const
|
||||
{
|
||||
|
@ -168,7 +168,6 @@ size_t Dictionary::GetLength(void) const
|
|||
*
|
||||
* @param key The key.
|
||||
* @returns true if the dictionary contains the key, false otherwise.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
bool Dictionary::Contains(const String& key) const
|
||||
{
|
||||
|
@ -182,7 +181,6 @@ bool Dictionary::Contains(const String& key) const
|
|||
* Removes the specified key from the dictionary.
|
||||
*
|
||||
* @param key The key.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Dictionary::Remove(const String& key)
|
||||
{
|
||||
|
@ -242,7 +240,6 @@ bool Dictionary::IsSealed(void) const
|
|||
* Makes a shallow copy of a dictionary.
|
||||
*
|
||||
* @returns a copy of the dictionary.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Dictionary::Ptr Dictionary::ShallowClone(void) const
|
||||
{
|
||||
|
@ -265,7 +262,6 @@ Dictionary::Ptr Dictionary::ShallowClone(void) const
|
|||
*
|
||||
* @param json The JSON object.
|
||||
* @returns A dictionary that is equivalent to the JSON object.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Dictionary::Ptr Dictionary::FromJson(cJSON *json)
|
||||
{
|
||||
|
@ -288,7 +284,6 @@ Dictionary::Ptr Dictionary::FromJson(cJSON *json)
|
|||
*
|
||||
* @returns A JSON object that is equivalent to the dictionary. Values that
|
||||
* cannot be represented in JSON are omitted.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
cJSON *Dictionary::ToJson(void) const
|
||||
{
|
||||
|
|
|
@ -68,9 +68,6 @@ DynamicObject::DynamicObject(const Dictionary::Ptr& serializedObject)
|
|||
boost::call_once(l_TransactionOnce, &DynamicObject::Initialize);
|
||||
}
|
||||
|
||||
/*
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
DynamicObject::~DynamicObject(void)
|
||||
{ }
|
||||
|
||||
|
@ -203,7 +200,7 @@ void DynamicObject::RegisterAttribute(const String& name,
|
|||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Caller must hold m_AttributeMutex.
|
||||
* Note: Caller must hold m_AttributeMutex.
|
||||
*/
|
||||
void DynamicObject::InternalRegisterAttribute(const String& name,
|
||||
AttributeType type, AttributeBase *boundAttribute)
|
||||
|
@ -223,9 +220,6 @@ void DynamicObject::InternalRegisterAttribute(const String& name,
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void DynamicObject::Set(const String& name, const Value& data)
|
||||
{
|
||||
ASSERT(!OwnsLock());
|
||||
|
@ -236,9 +230,6 @@ void DynamicObject::Set(const String& name, const Value& data)
|
|||
InternalSetAttribute(name, data, GetCurrentTx());
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void DynamicObject::Touch(const String& name)
|
||||
{
|
||||
ASSERT(OwnsLock());
|
||||
|
@ -260,9 +251,6 @@ void DynamicObject::Touch(const String& name)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Value DynamicObject::Get(const String& name) const
|
||||
{
|
||||
ASSERT(!OwnsLock());
|
||||
|
@ -274,7 +262,7 @@ Value DynamicObject::Get(const String& name) const
|
|||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Caller must hold m_AttributeMutex.
|
||||
* Note: Caller must hold m_AttributeMutex.
|
||||
*/
|
||||
void DynamicObject::InternalSetAttribute(const String& name, const Value& data,
|
||||
double tx, bool allowEditConfig)
|
||||
|
@ -315,7 +303,7 @@ void DynamicObject::InternalSetAttribute(const String& name, const Value& data,
|
|||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Caller must hold m_AttributeMutex.
|
||||
* Note: Caller must hold m_AttributeMutex.
|
||||
*/
|
||||
Value DynamicObject::InternalGetAttribute(const String& name) const
|
||||
{
|
||||
|
@ -330,51 +318,33 @@ Value DynamicObject::InternalGetAttribute(const String& name) const
|
|||
return it->second.GetValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
DynamicType::Ptr DynamicObject::GetType(void) const
|
||||
{
|
||||
return DynamicType::GetByName(m_Type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String DynamicObject::GetName(void) const
|
||||
{
|
||||
return m_Name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
bool DynamicObject::IsLocal(void) const
|
||||
{
|
||||
return m_Local;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
bool DynamicObject::IsRegistered(void) const
|
||||
{
|
||||
ObjectLock olock(GetType());
|
||||
return m_Registered;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void DynamicObject::SetSource(const String& value)
|
||||
{
|
||||
m_Source = value;
|
||||
Touch("__source");
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String DynamicObject::GetSource(void) const
|
||||
{
|
||||
return m_Source;
|
||||
|
@ -463,9 +433,6 @@ ScriptTask::Ptr DynamicObject::MakeMethodTask(const String& method,
|
|||
return boost::make_shared<ScriptTask>(func, arguments);
|
||||
}
|
||||
|
||||
/*
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void DynamicObject::DumpObjects(const String& filename)
|
||||
{
|
||||
Log(LogInformation, "base", "Dumping program state to file '" + filename + "'");
|
||||
|
@ -528,9 +495,6 @@ void DynamicObject::DumpObjects(const String& filename)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void DynamicObject::RestoreObjects(const String& filename)
|
||||
{
|
||||
Log(LogInformation, "base", "Restoring program state from file '" + filename + "'");
|
||||
|
@ -588,9 +552,6 @@ void DynamicObject::DeactivateObjects(void)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
double DynamicObject::GetCurrentTx(void)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_TransactionMutex);
|
||||
|
@ -608,9 +569,6 @@ void DynamicObject::Flush(void)
|
|||
OnFlushObject(GetCurrentTx(), GetSelf());
|
||||
}
|
||||
|
||||
/*
|
||||
* @threadsafety Always. Caller must not hold any Object locks.
|
||||
*/
|
||||
void DynamicObject::NewTx(void)
|
||||
{
|
||||
double tx;
|
||||
|
@ -650,9 +608,6 @@ void DynamicObject::OnAttributeChanged(const String&)
|
|||
ASSERT(!OwnsLock());
|
||||
}
|
||||
|
||||
/*
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
DynamicObject::Ptr DynamicObject::GetObject(const String& type, const String& name)
|
||||
{
|
||||
DynamicType::Ptr dtype = DynamicType::GetByName(type);
|
||||
|
|
|
@ -27,9 +27,6 @@ DynamicType::DynamicType(const String& name, const DynamicType::ObjectFactory& f
|
|||
: m_Name(name), m_ObjectFactory(factory)
|
||||
{ }
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
DynamicType::Ptr DynamicType::GetByName(const String& name)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(GetStaticMutex());
|
||||
|
@ -43,7 +40,7 @@ DynamicType::Ptr DynamicType::GetByName(const String& name)
|
|||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Caller must hold DynamicType::GetStaticMutex() while using the map.
|
||||
* Note: Caller must hold DynamicType::GetStaticMutex() while using the map.
|
||||
*/
|
||||
DynamicType::TypeMap& DynamicType::InternalGetTypeMap(void)
|
||||
{
|
||||
|
@ -120,9 +117,6 @@ void DynamicType::UnregisterObject(const DynamicObject::Ptr& object)
|
|||
object->OnUnregistrationCompleted();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
DynamicObject::Ptr DynamicType::GetObject(const String& name) const
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
@ -135,9 +129,6 @@ DynamicObject::Ptr DynamicType::GetObject(const String& name) const
|
|||
return nt->second;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void DynamicType::RegisterType(const DynamicType::Ptr& type)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(GetStaticMutex());
|
||||
|
|
|
@ -27,9 +27,6 @@
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
EventQueue::EventQueue(void)
|
||||
: m_Stopped(false)
|
||||
{
|
||||
|
@ -47,18 +44,12 @@ EventQueue::EventQueue(void)
|
|||
reportThread.detach();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
EventQueue::~EventQueue(void)
|
||||
{
|
||||
Stop();
|
||||
Join();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void EventQueue::Stop(void)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
|
@ -68,8 +59,6 @@ void EventQueue::Stop(void)
|
|||
|
||||
/**
|
||||
* Waits for all worker threads to finish.
|
||||
*
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void EventQueue::Join(void)
|
||||
{
|
||||
|
@ -78,8 +67,6 @@ void EventQueue::Join(void)
|
|||
|
||||
/**
|
||||
* Waits for events and processes them.
|
||||
*
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void EventQueue::QueueThreadProc(void)
|
||||
{
|
||||
|
@ -158,7 +145,6 @@ void EventQueue::QueueThreadProc(void)
|
|||
* Appends an event to the event queue. Events will be processed in FIFO order.
|
||||
*
|
||||
* @param callback The callback function for the event.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void EventQueue::Post(const EventQueue::Callback& callback)
|
||||
{
|
||||
|
|
|
@ -30,7 +30,6 @@ using namespace icinga;
|
|||
* @returns true if a complete String was read from the IOQueue, false otherwise.
|
||||
* @exception invalid_argument The input stream is invalid.
|
||||
* @see https://github.com/PeterScott/netString-c/blob/master/netString.c
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
bool NetString::ReadStringFromStream(const Stream::Ptr& stream, String *str)
|
||||
{
|
||||
|
@ -112,7 +111,6 @@ bool NetString::ReadStringFromStream(const Stream::Ptr& stream, String *str)
|
|||
*
|
||||
* @param stream The stream.
|
||||
* @param str The String that is to be written.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void NetString::WriteStringToStream(const Stream::Ptr& stream, const String& str)
|
||||
{
|
||||
|
|
|
@ -44,7 +44,6 @@ Object::~Object(void)
|
|||
* Returns a reference-counted pointer to this object.
|
||||
*
|
||||
* @returns A shared_ptr object that points to this object
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Object::SharedPtrHolder Object::GetSelf(void)
|
||||
{
|
||||
|
|
|
@ -26,9 +26,6 @@ RingBuffer::RingBuffer(RingBuffer::SizeType slots)
|
|||
: Object(), m_Slots(slots, 0), m_TimeValue(0)
|
||||
{ }
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
RingBuffer::SizeType RingBuffer::GetLength(void) const
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
@ -36,9 +33,6 @@ RingBuffer::SizeType RingBuffer::GetLength(void) const
|
|||
return m_Slots.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void RingBuffer::InsertValue(RingBuffer::SizeType tv, int num)
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
@ -64,9 +58,6 @@ void RingBuffer::InsertValue(RingBuffer::SizeType tv, int num)
|
|||
m_Slots[offsetTarget] += num;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
int RingBuffer::GetValues(RingBuffer::SizeType span) const
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
|
|
@ -40,9 +40,6 @@ Script::Script(const Dictionary::Ptr& serializedUpdate)
|
|||
RegisterAttribute("code", Attribute_Config, &m_Code);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Script::Start(void)
|
||||
{
|
||||
ASSERT(OwnsLock());
|
||||
|
@ -50,9 +47,6 @@ void Script::Start(void)
|
|||
SpawnInterpreter();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String Script::GetLanguage(void) const
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
@ -60,9 +54,6 @@ String Script::GetLanguage(void) const
|
|||
return m_Language;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String Script::GetCode(void) const
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
@ -70,9 +61,6 @@ String Script::GetCode(void) const
|
|||
return m_Code;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Script::OnAttributeUpdate(const String& name)
|
||||
{
|
||||
ASSERT(!OwnsLock());
|
||||
|
@ -81,9 +69,6 @@ void Script::OnAttributeUpdate(const String& name)
|
|||
SpawnInterpreter();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Script::SpawnInterpreter(void)
|
||||
{
|
||||
Log(LogInformation, "base", "Reloading script '" + GetName() + "'");
|
||||
|
|
|
@ -28,9 +28,6 @@ ScriptFunction::ScriptFunction(const Callback& function)
|
|||
: m_Callback(function)
|
||||
{ }
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void ScriptFunction::Invoke(const ScriptTask::Ptr& task, const std::vector<Value>& arguments)
|
||||
{
|
||||
m_Callback(task, arguments);
|
||||
|
|
|
@ -24,9 +24,6 @@ using namespace icinga;
|
|||
ScriptLanguage::ScriptLanguage(void)
|
||||
{ }
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void ScriptLanguage::Register(const String& name, const ScriptLanguage::Ptr& language)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(GetMutex());
|
||||
|
@ -34,9 +31,6 @@ void ScriptLanguage::Register(const String& name, const ScriptLanguage::Ptr& lan
|
|||
GetLanguages()[name] = language;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void ScriptLanguage::Unregister(const String& name)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(GetMutex());
|
||||
|
@ -44,9 +38,6 @@ void ScriptLanguage::Unregister(const String& name)
|
|||
GetLanguages().erase(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
ScriptLanguage::Ptr ScriptLanguage::GetByName(const String& name)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(GetMutex());
|
||||
|
|
|
@ -45,9 +45,6 @@ StdioStream::~StdioStream(void)
|
|||
m_ReadAheadBuffer->Close();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void StdioStream::Start(void)
|
||||
{
|
||||
SetConnected(true);
|
||||
|
@ -55,9 +52,6 @@ void StdioStream::Start(void)
|
|||
Stream::Start();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
size_t StdioStream::GetAvailableBytes(void) const
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
@ -68,9 +62,6 @@ size_t StdioStream::GetAvailableBytes(void) const
|
|||
return 1024; /* doesn't have to be accurate */
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
size_t StdioStream::Read(void *buffer, size_t size)
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
@ -86,9 +77,6 @@ size_t StdioStream::Read(void *buffer, size_t size)
|
|||
return peek_len + read_len;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
size_t StdioStream::Peek(void *buffer, size_t size)
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
@ -105,9 +93,6 @@ size_t StdioStream::Peek(void *buffer, size_t size)
|
|||
return peek_len + read_len;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void StdioStream::Write(const void *buffer, size_t size)
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
@ -115,9 +100,6 @@ void StdioStream::Write(const void *buffer, size_t size)
|
|||
m_InnerStream->write(static_cast<const char *>(buffer), size);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void StdioStream::Close(void)
|
||||
{
|
||||
if (m_OwnsStream)
|
||||
|
|
|
@ -33,9 +33,6 @@ Stream::~Stream(void)
|
|||
ASSERT(!m_Running);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
bool Stream::IsConnected(void) const
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
@ -43,9 +40,6 @@ bool Stream::IsConnected(void) const
|
|||
return m_Connected;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
bool Stream::IsReadEOF(void) const
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
@ -53,9 +47,6 @@ bool Stream::IsReadEOF(void) const
|
|||
return m_ReadEOF;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
bool Stream::IsWriteEOF(void) const
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
@ -63,9 +54,6 @@ bool Stream::IsWriteEOF(void) const
|
|||
return m_WriteEOF;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Stream::SetConnected(bool connected)
|
||||
{
|
||||
bool changed;
|
||||
|
@ -84,9 +72,6 @@ void Stream::SetConnected(bool connected)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Stream::SetReadEOF(bool eof)
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
@ -94,9 +79,6 @@ void Stream::SetReadEOF(bool eof)
|
|||
m_ReadEOF = eof;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Stream::SetWriteEOF(bool eof)
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
@ -107,8 +89,6 @@ void Stream::SetWriteEOF(bool eof)
|
|||
/**
|
||||
* Checks whether an exception is available for this stream and re-throws
|
||||
* the exception if there is one.
|
||||
*
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Stream::CheckException(void)
|
||||
{
|
||||
|
@ -118,9 +98,6 @@ void Stream::CheckException(void)
|
|||
rethrow_exception(m_Exception);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Stream::SetException(boost::exception_ptr exception)
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
@ -128,17 +105,11 @@ void Stream::SetException(boost::exception_ptr exception)
|
|||
m_Exception = exception;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
boost::exception_ptr Stream::GetException(void)
|
||||
{
|
||||
return m_Exception;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Stream::Start(void)
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
@ -146,9 +117,6 @@ void Stream::Start(void)
|
|||
m_Running = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Stream::Close(void)
|
||||
{
|
||||
{
|
||||
|
|
|
@ -49,17 +49,11 @@ typedef struct I2Stream_bio_s
|
|||
boost::exception_ptr Exception;
|
||||
} I2Stream_bio_t;
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
BIO_METHOD *BIO_s_I2Stream(void)
|
||||
{
|
||||
return &I2Stream_method;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
BIO *icinga::BIO_new_I2Stream(const Stream::Ptr& stream)
|
||||
{
|
||||
BIO *bi = BIO_new(BIO_s_I2Stream());
|
||||
|
@ -74,9 +68,6 @@ BIO *icinga::BIO_new_I2Stream(const Stream::Ptr& stream)
|
|||
return bi;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void icinga::I2Stream_check_exception(BIO *bi) {
|
||||
I2Stream_bio_t *bp = (I2Stream_bio_t *)bi->ptr;
|
||||
|
||||
|
@ -87,9 +78,6 @@ void icinga::I2Stream_check_exception(BIO *bi) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
static int I2Stream_new(BIO *bi)
|
||||
{
|
||||
bi->shutdown = 0;
|
||||
|
@ -100,9 +88,6 @@ static int I2Stream_new(BIO *bi)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
static int I2Stream_free(BIO *bi)
|
||||
{
|
||||
I2Stream_bio_t *bp = (I2Stream_bio_t *)bi->ptr;
|
||||
|
@ -111,9 +96,6 @@ static int I2Stream_free(BIO *bi)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
static int I2Stream_read(BIO *bi, char *out, int outl)
|
||||
{
|
||||
I2Stream_bio_t *bp = (I2Stream_bio_t *)bi->ptr;
|
||||
|
@ -137,9 +119,6 @@ static int I2Stream_read(BIO *bi, char *out, int outl)
|
|||
return data_read;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
static int I2Stream_write(BIO *bi, const char *in, int inl)
|
||||
{
|
||||
I2Stream_bio_t *bp = (I2Stream_bio_t *)bi->ptr;
|
||||
|
@ -148,9 +127,6 @@ static int I2Stream_write(BIO *bi, const char *in, int inl)
|
|||
return inl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
static long I2Stream_ctrl(BIO *, int cmd, long, void *)
|
||||
{
|
||||
switch (cmd) {
|
||||
|
|
|
@ -53,9 +53,6 @@ StreamLogger::~StreamLogger(void)
|
|||
delete m_Stream;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void StreamLogger::OpenFile(const String& filename)
|
||||
{
|
||||
std::ofstream *stream = new std::ofstream();
|
||||
|
@ -83,7 +80,6 @@ void StreamLogger::OpenFile(const String& filename)
|
|||
* @param stream The output stream.
|
||||
* @param tty Whether the output stream is a TTY.
|
||||
* @param entry The log entry.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void StreamLogger::ProcessLogEntry(std::ostream& stream, bool tty, const LogEntry& entry)
|
||||
{
|
||||
|
@ -118,7 +114,6 @@ void StreamLogger::ProcessLogEntry(std::ostream& stream, bool tty, const LogEntr
|
|||
* Processes a log entry and outputs it to a stream.
|
||||
*
|
||||
* @param entry The log entry.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void StreamLogger::ProcessLogEntry(const LogEntry& entry)
|
||||
{
|
||||
|
@ -128,7 +123,10 @@ void StreamLogger::ProcessLogEntry(const LogEntry& entry)
|
|||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
* Checks whether the specified stream is a terminal.
|
||||
*
|
||||
* @param stream The stream.
|
||||
* @returns true if the stream is a terminal, false otherwise.
|
||||
*/
|
||||
bool StreamLogger::IsTty(std::ostream& stream)
|
||||
{
|
||||
|
|
|
@ -26,7 +26,6 @@ using namespace icinga;
|
|||
* Processes a log entry and outputs it to syslog.
|
||||
*
|
||||
* @param entry The log entry.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void SyslogLogger::ProcessLogEntry(const LogEntry& entry)
|
||||
{
|
||||
|
|
|
@ -42,7 +42,6 @@ void TcpSocket::Bind(String service, int family)
|
|||
* @param node The node.
|
||||
* @param service The service.
|
||||
* @param family The address family for the socket.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void TcpSocket::Bind(String node, String service, int family)
|
||||
{
|
||||
|
@ -113,7 +112,6 @@ void TcpSocket::Bind(String node, String service, int family)
|
|||
*
|
||||
* @param node The node.
|
||||
* @param service The service.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void TcpSocket::Connect(const String& node, const String& service)
|
||||
{
|
||||
|
|
|
@ -40,9 +40,10 @@ struct icinga::TimerNextExtractor
|
|||
/**
|
||||
* Extracts the next timestamp from a Timer.
|
||||
*
|
||||
* Note: Caller must hold l_Mutex.
|
||||
*
|
||||
* @param wtimer Weak pointer to the timer.
|
||||
* @returns The next timestamp
|
||||
* @threadsafety Caller must hold l_Mutex.
|
||||
*/
|
||||
double operator()(const weak_ptr<Timer>& wtimer)
|
||||
{
|
||||
|
@ -71,8 +72,6 @@ static TimerSet l_Timers;
|
|||
|
||||
/**
|
||||
* Constructor for the Timer class.
|
||||
*
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Timer::Timer(void)
|
||||
: m_Interval(0), m_Next(0)
|
||||
|
@ -80,8 +79,6 @@ Timer::Timer(void)
|
|||
|
||||
/**
|
||||
* Initializes the timer sub-system.
|
||||
*
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Timer::Initialize(void)
|
||||
{
|
||||
|
@ -92,8 +89,6 @@ void Timer::Initialize(void)
|
|||
|
||||
/**
|
||||
* Disables the timer sub-system.
|
||||
*
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Timer::Uninitialize(void)
|
||||
{
|
||||
|
@ -108,8 +103,6 @@ void Timer::Uninitialize(void)
|
|||
|
||||
/**
|
||||
* Calls this timer.
|
||||
*
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Timer::Call(void)
|
||||
{
|
||||
|
@ -132,7 +125,6 @@ void Timer::Call(void)
|
|||
* Sets the interval for this timer.
|
||||
*
|
||||
* @param interval The new interval.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Timer::SetInterval(double interval)
|
||||
{
|
||||
|
@ -146,7 +138,6 @@ void Timer::SetInterval(double interval)
|
|||
* Retrieves the interval for this timer.
|
||||
*
|
||||
* @returns The interval.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
double Timer::GetInterval(void) const
|
||||
{
|
||||
|
@ -158,8 +149,6 @@ double Timer::GetInterval(void) const
|
|||
|
||||
/**
|
||||
* Registers the timer and starts processing events for it.
|
||||
*
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Timer::Start(void)
|
||||
{
|
||||
|
@ -175,8 +164,6 @@ void Timer::Start(void)
|
|||
|
||||
/**
|
||||
* Unregisters the timer and stops processing events for it.
|
||||
*
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Timer::Stop(void)
|
||||
{
|
||||
|
@ -196,7 +183,6 @@ void Timer::Stop(void)
|
|||
*
|
||||
* @param next The time when this timer should be called again. Use -1 to let
|
||||
* the timer figure out a suitable time based on the interval.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Timer::Reschedule(double next)
|
||||
{
|
||||
|
@ -228,7 +214,6 @@ void Timer::Reschedule(double next)
|
|||
* Retrieves when the timer is next due.
|
||||
*
|
||||
* @returns The timestamp.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
double Timer::GetNext(void) const
|
||||
{
|
||||
|
@ -243,7 +228,6 @@ double Timer::GetNext(void) const
|
|||
* next scheduled timestamp.
|
||||
*
|
||||
* @param adjustment The adjustment.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Timer::AdjustTimers(double adjustment)
|
||||
{
|
||||
|
@ -272,8 +256,6 @@ void Timer::AdjustTimers(double adjustment)
|
|||
|
||||
/**
|
||||
* Worker thread proc for Timer objects.
|
||||
*
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Timer::TimerThreadProc(void)
|
||||
{
|
||||
|
|
|
@ -397,7 +397,6 @@ DynamicObject::Ptr ConfigItem::GetDynamicObject(void) const
|
|||
* @param type The type of the ConfigItem that is to be looked up.
|
||||
* @param name The name of the ConfigItem that is to be looked up.
|
||||
* @returns The configuration item.
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
ConfigItem::Ptr ConfigItem::GetObject(const String& type, const String& name)
|
||||
{
|
||||
|
@ -444,9 +443,6 @@ void ConfigItem::Dump(std::ostream& fp) const
|
|||
fp << "}" << "\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void ConfigItem::UnloadUnit(const String& unit)
|
||||
{
|
||||
std::vector<ConfigItem::Ptr> obsoleteItems;
|
||||
|
|
|
@ -88,9 +88,6 @@ void ConfigType::ValidateItem(const ConfigItem::Ptr& item) const
|
|||
ValidateDictionary(attrs, ruleLists, locations);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String ConfigType::LocationToString(const std::vector<String>& locations)
|
||||
{
|
||||
bool first = true;
|
||||
|
@ -107,9 +104,6 @@ String ConfigType::LocationToString(const std::vector<String>& locations)
|
|||
return stack;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void ConfigType::ValidateDictionary(const Dictionary::Ptr& dictionary,
|
||||
const std::vector<TypeRuleList::Ptr>& ruleLists, std::vector<String>& locations)
|
||||
{
|
||||
|
@ -188,9 +182,6 @@ void ConfigType::ValidateDictionary(const Dictionary::Ptr& dictionary,
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void ConfigType::ValidateArray(const Array::Ptr& array,
|
||||
const std::vector<TypeRuleList::Ptr>& ruleLists, std::vector<String>& locations)
|
||||
{
|
||||
|
|
|
@ -182,9 +182,6 @@ void Expression::DumpValue(std::ostream& fp, int indent, const Value& value, boo
|
|||
BOOST_THROW_EXCEPTION(std::runtime_error("Encountered unknown type while dumping value."));
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Expression::Dump(std::ostream& fp, int indent) const
|
||||
{
|
||||
if (m_Operator == OperatorExecute) {
|
||||
|
|
|
@ -25,9 +25,6 @@ using namespace icinga;
|
|||
|
||||
REGISTER_SCRIPTFUNCTION(GetAnswerToEverything, &API::GetAnswerToEverything);
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void API::GetAnswerToEverything(const ScriptTask::Ptr& task, const std::vector<Value>& arguments)
|
||||
{
|
||||
if (arguments.size() < 1)
|
||||
|
|
|
@ -24,33 +24,21 @@ using namespace icinga;
|
|||
RingBuffer CIB::m_ActiveChecksStatistics(15 * 60);
|
||||
RingBuffer CIB::m_PassiveChecksStatistics(15 * 60);
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void CIB::UpdateActiveChecksStatistics(long tv, int num)
|
||||
{
|
||||
m_ActiveChecksStatistics.InsertValue(tv, num);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
int CIB::GetActiveChecksStatistics(long timespan)
|
||||
{
|
||||
return m_ActiveChecksStatistics.GetValues(timespan);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void CIB::UpdatePassiveChecksStatistics(long tv, int num)
|
||||
{
|
||||
m_PassiveChecksStatistics.InsertValue(tv, num);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
int CIB::GetPassiveChecksStatistics(long timespan)
|
||||
{
|
||||
return m_PassiveChecksStatistics.GetValues(timespan);
|
||||
|
|
|
@ -40,9 +40,6 @@ boost::once_flag ExternalCommandProcessor::m_InitializeOnce = BOOST_ONCE_INIT;
|
|||
boost::mutex ExternalCommandProcessor::m_Mutex;
|
||||
std::map<String, ExternalCommandProcessor::Callback> ExternalCommandProcessor::m_Commands;
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void ExternalCommandProcessor::Execute(const String& line)
|
||||
{
|
||||
if (line.IsEmpty())
|
||||
|
@ -74,9 +71,6 @@ void ExternalCommandProcessor::Execute(const String& line)
|
|||
Execute(ts, argv[0], argvExtra);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void ExternalCommandProcessor::Execute(double time, const String& command, const std::vector<String>& arguments)
|
||||
{
|
||||
boost::call_once(m_InitializeOnce, &ExternalCommandProcessor::Initialize);
|
||||
|
@ -98,9 +92,6 @@ void ExternalCommandProcessor::Execute(double time, const String& command, const
|
|||
callback(time, arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void ExternalCommandProcessor::Initialize(void)
|
||||
{
|
||||
RegisterCommand("PROCESS_HOST_CHECK_RESULT", &ExternalCommandProcessor::ProcessHostCheckResult);
|
||||
|
@ -162,9 +153,6 @@ void ExternalCommandProcessor::Initialize(void)
|
|||
RegisterCommand("DISABLE_SVC_NOTIFICATIONS", &ExternalCommandProcessor::DisableSvcNotifications);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void ExternalCommandProcessor::RegisterCommand(const String& command, const ExternalCommandProcessor::Callback& callback)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
|
|
|
@ -83,9 +83,6 @@ String Host::GetDisplayName(void) const
|
|||
return GetName();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Host::Ptr Host::GetByName(const String& name)
|
||||
{
|
||||
DynamicObject::Ptr configObject = DynamicObject::GetObject("Host", name);
|
||||
|
|
|
@ -47,9 +47,6 @@ HostGroup::~HostGroup(void)
|
|||
InvalidateMembersCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void HostGroup::OnRegistrationCompleted(void)
|
||||
{
|
||||
ASSERT(!OwnsLock());
|
||||
|
@ -57,9 +54,6 @@ void HostGroup::OnRegistrationCompleted(void)
|
|||
InvalidateMembersCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String HostGroup::GetDisplayName(void) const
|
||||
{
|
||||
if (!m_DisplayName.IsEmpty())
|
||||
|
@ -68,25 +62,16 @@ String HostGroup::GetDisplayName(void) const
|
|||
return GetName();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String HostGroup::GetNotesUrl(void) const
|
||||
{
|
||||
return m_NotesUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String HostGroup::GetActionUrl(void) const
|
||||
{
|
||||
return m_ActionUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
HostGroup::Ptr HostGroup::GetByName(const String& name)
|
||||
{
|
||||
DynamicObject::Ptr configObject = DynamicObject::GetObject("HostGroup", name);
|
||||
|
@ -97,9 +82,6 @@ HostGroup::Ptr HostGroup::GetByName(const String& name)
|
|||
return dynamic_pointer_cast<HostGroup>(configObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
std::set<Host::Ptr> HostGroup::GetMembers(void) const
|
||||
{
|
||||
std::set<Host::Ptr> hosts;
|
||||
|
@ -120,9 +102,6 @@ std::set<Host::Ptr> HostGroup::GetMembers(void) const
|
|||
return hosts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void HostGroup::InvalidateMembersCache(void)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_Mutex);
|
||||
|
@ -140,9 +119,6 @@ void HostGroup::InvalidateMembersCache(void)
|
|||
l_MembersCacheNeedsUpdate = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void HostGroup::RefreshMembersCache(void)
|
||||
{
|
||||
{
|
||||
|
|
|
@ -93,9 +93,6 @@ int IcingaApplication::Main(void)
|
|||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void IcingaApplication::OnShutdown(void)
|
||||
{
|
||||
ASSERT(!OwnsLock());
|
||||
|
@ -108,9 +105,6 @@ void IcingaApplication::OnShutdown(void)
|
|||
DumpProgramState();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void IcingaApplication::DumpProgramState(void)
|
||||
{
|
||||
DynamicObject::DumpObjects(GetStatePath());
|
||||
|
@ -121,9 +115,6 @@ IcingaApplication::Ptr IcingaApplication::GetInstance(void)
|
|||
return static_pointer_cast<IcingaApplication>(Application::GetInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String IcingaApplication::GetCertificateFile(void) const
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
@ -131,9 +122,6 @@ String IcingaApplication::GetCertificateFile(void) const
|
|||
return m_CertPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String IcingaApplication::GetCAFile(void) const
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
@ -141,9 +129,6 @@ String IcingaApplication::GetCAFile(void) const
|
|||
return m_CAPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String IcingaApplication::GetNode(void) const
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
@ -151,9 +136,6 @@ String IcingaApplication::GetNode(void) const
|
|||
return m_Node;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String IcingaApplication::GetService(void) const
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
@ -161,9 +143,6 @@ String IcingaApplication::GetService(void) const
|
|||
return m_Service;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String IcingaApplication::GetPidPath(void) const
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
@ -174,9 +153,6 @@ String IcingaApplication::GetPidPath(void) const
|
|||
return m_PidPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String IcingaApplication::GetStatePath(void) const
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
@ -187,9 +163,6 @@ String IcingaApplication::GetStatePath(void) const
|
|||
return m_PidPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Dictionary::Ptr IcingaApplication::GetMacros(void) const
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
@ -197,9 +170,6 @@ Dictionary::Ptr IcingaApplication::GetMacros(void) const
|
|||
return m_Macros;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
double IcingaApplication::GetStartTime(void) const
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
@ -207,9 +177,6 @@ double IcingaApplication::GetStartTime(void) const
|
|||
return m_StartTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
shared_ptr<SSL_CTX> IcingaApplication::GetSSLContext(void) const
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
@ -217,9 +184,6 @@ shared_ptr<SSL_CTX> IcingaApplication::GetSSLContext(void) const
|
|||
return m_SSLContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Dictionary::Ptr IcingaApplication::CalculateDynamicMacros(void)
|
||||
{
|
||||
Dictionary::Ptr macros = boost::make_shared<Dictionary>();
|
||||
|
|
|
@ -27,9 +27,6 @@
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Value MacroProcessor::ResolveMacros(const Value& cmd, const Dictionary::Ptr& macros,
|
||||
const MacroProcessor::EscapeCallback& escapeFn)
|
||||
{
|
||||
|
@ -58,9 +55,6 @@ Value MacroProcessor::ResolveMacros(const Value& cmd, const Dictionary::Ptr& mac
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String MacroProcessor::InternalResolveMacros(const String& str, const Dictionary::Ptr& macros,
|
||||
const MacroProcessor::EscapeCallback& escapeFn)
|
||||
{
|
||||
|
@ -87,9 +81,6 @@ String MacroProcessor::InternalResolveMacros(const String& str, const Dictionary
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Dictionary::Ptr MacroProcessor::MergeMacroDicts(const std::vector<Dictionary::Ptr>& dicts)
|
||||
{
|
||||
Dictionary::Ptr result = boost::make_shared<Dictionary>();
|
||||
|
|
|
@ -51,9 +51,6 @@ Notification::~Notification(void)
|
|||
Service::InvalidateNotificationsCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Notification::Ptr Notification::GetByName(const String& name)
|
||||
{
|
||||
DynamicObject::Ptr configObject = DynamicObject::GetObject("Notification", name);
|
||||
|
@ -61,9 +58,6 @@ Notification::Ptr Notification::GetByName(const String& name)
|
|||
return dynamic_pointer_cast<Notification>(configObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Service::Ptr Notification::GetService(void) const
|
||||
{
|
||||
Host::Ptr host = Host::GetByName(m_HostName);
|
||||
|
@ -77,25 +71,16 @@ Service::Ptr Notification::GetService(void) const
|
|||
return host->GetServiceByShortName(m_Service);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Value Notification::GetNotificationCommand(void) const
|
||||
{
|
||||
return m_NotificationCommand;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Dictionary::Ptr Notification::GetMacros(void) const
|
||||
{
|
||||
return m_Macros;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
std::set<User::Ptr> Notification::GetUsers(void) const
|
||||
{
|
||||
std::set<User::Ptr> result;
|
||||
|
@ -118,9 +103,6 @@ std::set<User::Ptr> Notification::GetUsers(void) const
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
std::set<UserGroup::Ptr> Notification::GetGroups(void) const
|
||||
{
|
||||
std::set<UserGroup::Ptr> result;
|
||||
|
@ -143,9 +125,6 @@ std::set<UserGroup::Ptr> Notification::GetGroups(void) const
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
double Notification::GetNotificationInterval(void) const
|
||||
{
|
||||
if (m_NotificationInterval.IsEmpty())
|
||||
|
@ -154,17 +133,11 @@ double Notification::GetNotificationInterval(void) const
|
|||
return m_NotificationInterval;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
TimePeriod::Ptr Notification::GetNotificationPeriod(void) const
|
||||
{
|
||||
return TimePeriod::GetByName(m_NotificationPeriod);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
double Notification::GetLastNotification(void) const
|
||||
{
|
||||
if (m_LastNotification.IsEmpty())
|
||||
|
@ -182,9 +155,6 @@ void Notification::SetLastNotification(double time)
|
|||
Touch("last_notification");
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
double Notification::GetNextNotification(void) const
|
||||
{
|
||||
if (m_NextNotification.IsEmpty())
|
||||
|
@ -203,9 +173,6 @@ void Notification::SetNextNotification(double time)
|
|||
Touch("next_notification");
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String Notification::NotificationTypeToString(NotificationType type)
|
||||
{
|
||||
switch (type) {
|
||||
|
@ -228,9 +195,6 @@ String Notification::NotificationTypeToString(NotificationType type)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Notification::BeginExecuteNotification(NotificationType type, const Dictionary::Ptr& cr, bool ignore_timeperiod)
|
||||
{
|
||||
ASSERT(!OwnsLock());
|
||||
|
@ -268,9 +232,6 @@ void Notification::BeginExecuteNotification(NotificationType type, const Diction
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Notification::BeginExecuteNotificationHelper(const Dictionary::Ptr& notificationMacros,
|
||||
NotificationType type, const User::Ptr& user, bool ignore_timeperiod)
|
||||
{
|
||||
|
@ -320,9 +281,6 @@ void Notification::BeginExecuteNotificationHelper(const Dictionary::Ptr& notific
|
|||
task->Start(boost::bind(&Notification::NotificationCompletedHandler, self, _1));
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Notification::NotificationCompletedHandler(const ScriptTask::Ptr& task)
|
||||
{
|
||||
ASSERT(!OwnsLock());
|
||||
|
@ -347,9 +305,6 @@ void Notification::NotificationCompletedHandler(const ScriptTask::Ptr& task)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Notification::OnAttributeChanged(const String& name)
|
||||
{
|
||||
ASSERT(!OwnsLock());
|
||||
|
|
|
@ -26,9 +26,6 @@ using namespace icinga;
|
|||
|
||||
REGISTER_SCRIPTFUNCTION(NullCheck, &NullCheckTask::ScriptFunc);
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void NullCheckTask::ScriptFunc(const ScriptTask::Ptr& task, const std::vector<Value>& arguments)
|
||||
{
|
||||
if (arguments.size() < 1)
|
||||
|
|
|
@ -40,13 +40,6 @@ PerfdataWriter::PerfdataWriter(const Dictionary::Ptr& properties)
|
|||
RegisterAttribute("rotation_interval", Attribute_Config, &m_RotationInterval);
|
||||
}
|
||||
|
||||
PerfdataWriter::~PerfdataWriter(void)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void PerfdataWriter::OnAttributeChanged(const String& name)
|
||||
{
|
||||
ASSERT(!OwnsLock());
|
||||
|
@ -56,9 +49,6 @@ void PerfdataWriter::OnAttributeChanged(const String& name)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void PerfdataWriter::Start(void)
|
||||
{
|
||||
m_Endpoint = Endpoint::MakeEndpoint("perfdata_" + GetName(), false);
|
||||
|
@ -73,9 +63,6 @@ void PerfdataWriter::Start(void)
|
|||
RotateFile();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
PerfdataWriter::Ptr PerfdataWriter::GetByName(const String& name)
|
||||
{
|
||||
DynamicObject::Ptr configObject = DynamicObject::GetObject("PerfdataWriter", name);
|
||||
|
@ -83,9 +70,6 @@ PerfdataWriter::Ptr PerfdataWriter::GetByName(const String& name)
|
|||
return dynamic_pointer_cast<PerfdataWriter>(configObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String PerfdataWriter::GetPathPrefix(void) const
|
||||
{
|
||||
if (!m_PathPrefix.IsEmpty())
|
||||
|
@ -94,9 +78,6 @@ String PerfdataWriter::GetPathPrefix(void) const
|
|||
return Application::GetLocalStateDir() + "/cache/icinga2/perfdata/perfdata";
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String PerfdataWriter::GetFormatTemplate(void) const
|
||||
{
|
||||
if (!m_FormatTemplate.IsEmpty()) {
|
||||
|
@ -115,9 +96,6 @@ String PerfdataWriter::GetFormatTemplate(void) const
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
double PerfdataWriter::GetRotationInterval(void) const
|
||||
{
|
||||
if (!m_RotationInterval.IsEmpty())
|
||||
|
@ -126,9 +104,6 @@ double PerfdataWriter::GetRotationInterval(void) const
|
|||
return 30;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void PerfdataWriter::CheckResultRequestHandler(const RequestMessage& request)
|
||||
{
|
||||
CheckResultMessage params;
|
||||
|
@ -152,9 +127,6 @@ void PerfdataWriter::CheckResultRequestHandler(const RequestMessage& request)
|
|||
m_OutputFile << line << "\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void PerfdataWriter::RotateFile(void)
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
@ -174,9 +146,6 @@ void PerfdataWriter::RotateFile(void)
|
|||
Log(LogWarning, "icinga", "Could not open perfdata file '" + tempFile + "' for writing. Perfdata will be lost.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void PerfdataWriter::RotationTimerHandler(void)
|
||||
{
|
||||
RotateFile();
|
||||
|
|
|
@ -41,7 +41,6 @@ public:
|
|||
typedef weak_ptr<PerfdataWriter> WeakPtr;
|
||||
|
||||
PerfdataWriter(const Dictionary::Ptr& properties);
|
||||
~PerfdataWriter(void);
|
||||
|
||||
static PerfdataWriter::Ptr GetByName(const String& name);
|
||||
|
||||
|
|
|
@ -33,9 +33,6 @@ PluginCheckTask::PluginCheckTask(const ScriptTask::Ptr& task, const Process::Ptr
|
|||
: m_Task(task), m_Process(process), m_Command(command)
|
||||
{ }
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void PluginCheckTask::ScriptFunc(const ScriptTask::Ptr& task, const std::vector<Value>& arguments)
|
||||
{
|
||||
if (arguments.size() < 1)
|
||||
|
@ -57,9 +54,6 @@ void PluginCheckTask::ScriptFunc(const ScriptTask::Ptr& task, const std::vector<
|
|||
process->Start(boost::bind(&PluginCheckTask::ProcessFinishedHandler, ct));
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void PluginCheckTask::ProcessFinishedHandler(PluginCheckTask ct)
|
||||
{
|
||||
ProcessResult pr;
|
||||
|
@ -83,9 +77,6 @@ void PluginCheckTask::ProcessFinishedHandler(PluginCheckTask ct)
|
|||
ct.m_Task->FinishResult(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
ServiceState PluginCheckTask::ExitStatusToState(int exitStatus)
|
||||
{
|
||||
switch (exitStatus) {
|
||||
|
@ -100,9 +91,6 @@ ServiceState PluginCheckTask::ExitStatusToState(int exitStatus)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Dictionary::Ptr PluginCheckTask::ParseCheckOutput(const String& output)
|
||||
{
|
||||
Dictionary::Ptr result = boost::make_shared<Dictionary>();
|
||||
|
|
|
@ -34,9 +34,6 @@ PluginNotificationTask::PluginNotificationTask(const ScriptTask::Ptr& task, cons
|
|||
: m_Task(task), m_Process(process), m_ServiceName(service), m_Command(command)
|
||||
{ }
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void PluginNotificationTask::ScriptFunc(const ScriptTask::Ptr& task, const std::vector<Value>& arguments)
|
||||
{
|
||||
if (arguments.size() < 1)
|
||||
|
@ -78,9 +75,6 @@ void PluginNotificationTask::ScriptFunc(const ScriptTask::Ptr& task, const std::
|
|||
process->Start(boost::bind(&PluginNotificationTask::ProcessFinishedHandler, ct));
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void PluginNotificationTask::ProcessFinishedHandler(PluginNotificationTask ct)
|
||||
{
|
||||
ProcessResult pr;
|
||||
|
|
|
@ -38,17 +38,11 @@ const double Service::CheckIntervalDivisor = 5.0;
|
|||
boost::signals2::signal<void (const Service::Ptr&)> Service::OnCheckerChanged;
|
||||
boost::signals2::signal<void (const Service::Ptr&)> Service::OnNextCheckChanged;
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Value Service::GetCheckCommand(void) const
|
||||
{
|
||||
return m_CheckCommand;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
long Service::GetMaxCheckAttempts(void) const
|
||||
{
|
||||
if (m_MaxCheckAttempts.IsEmpty())
|
||||
|
@ -57,17 +51,11 @@ long Service::GetMaxCheckAttempts(void) const
|
|||
return m_MaxCheckAttempts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
TimePeriod::Ptr Service::GetCheckPeriod(void) const
|
||||
{
|
||||
return TimePeriod::GetByName(m_CheckPeriod);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
double Service::GetCheckInterval(void) const
|
||||
{
|
||||
if (m_CheckInterval.IsEmpty())
|
||||
|
@ -76,9 +64,6 @@ double Service::GetCheckInterval(void) const
|
|||
return m_CheckInterval;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
double Service::GetRetryInterval(void) const
|
||||
{
|
||||
if (m_RetryInterval.IsEmpty())
|
||||
|
@ -87,50 +72,32 @@ double Service::GetRetryInterval(void) const
|
|||
return m_RetryInterval;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Array::Ptr Service::GetCheckers(void) const
|
||||
{
|
||||
return m_Checkers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::SetSchedulingOffset(long offset)
|
||||
{
|
||||
m_SchedulingOffset = offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
long Service::GetSchedulingOffset(void)
|
||||
{
|
||||
return m_SchedulingOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::SetNextCheck(double nextCheck)
|
||||
{
|
||||
m_NextCheck = nextCheck;
|
||||
Touch("next_check");
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
double Service::GetNextCheck(void)
|
||||
{
|
||||
return m_NextCheck;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::UpdateNextCheck(void)
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
@ -151,35 +118,23 @@ void Service::UpdateNextCheck(void)
|
|||
SetNextCheck(now - adj + interval);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::SetCurrentChecker(const String& checker)
|
||||
{
|
||||
m_CurrentChecker = checker;
|
||||
Touch("current_checker");
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String Service::GetCurrentChecker(void) const
|
||||
{
|
||||
return m_CurrentChecker;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::SetCurrentCheckAttempt(long attempt)
|
||||
{
|
||||
m_CheckAttempt = attempt;
|
||||
Touch("check_attempt");
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
long Service::GetCurrentCheckAttempt(void) const
|
||||
{
|
||||
if (m_CheckAttempt.IsEmpty())
|
||||
|
@ -188,18 +143,12 @@ long Service::GetCurrentCheckAttempt(void) const
|
|||
return m_CheckAttempt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::SetState(ServiceState state)
|
||||
{
|
||||
m_State = static_cast<long>(state);
|
||||
Touch("state");
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
ServiceState Service::GetState(void) const
|
||||
{
|
||||
if (m_State.IsEmpty())
|
||||
|
@ -225,18 +174,12 @@ ServiceState Service::GetLastState(void) const
|
|||
return static_cast<ServiceState>(ivalue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::SetStateType(StateType type)
|
||||
{
|
||||
m_StateType = static_cast<long>(type);
|
||||
Touch("state_type");
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
StateType Service::GetStateType(void) const
|
||||
{
|
||||
if (m_StateType.IsEmpty())
|
||||
|
@ -246,18 +189,12 @@ StateType Service::GetStateType(void) const
|
|||
return static_cast<StateType>(ivalue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::SetLastStateType(StateType type)
|
||||
{
|
||||
m_LastStateType = static_cast<long>(type);
|
||||
Touch("last_state_type");
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
StateType Service::GetLastStateType(void) const
|
||||
{
|
||||
if (m_LastStateType.IsEmpty())
|
||||
|
@ -267,18 +204,12 @@ StateType Service::GetLastStateType(void) const
|
|||
return static_cast<StateType>(ivalue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::SetLastReachable(bool reachable)
|
||||
{
|
||||
m_LastReachable = reachable;
|
||||
Touch("last_reachable");
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
bool Service::GetLastReachable(void) const
|
||||
{
|
||||
if (m_LastReachable.IsEmpty())
|
||||
|
@ -287,35 +218,23 @@ bool Service::GetLastReachable(void) const
|
|||
return m_LastReachable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::SetLastCheckResult(const Dictionary::Ptr& result)
|
||||
{
|
||||
m_LastResult = result;
|
||||
Touch("last_result");
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Dictionary::Ptr Service::GetLastCheckResult(void) const
|
||||
{
|
||||
return m_LastResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::SetLastStateChange(double ts)
|
||||
{
|
||||
m_LastStateChange = ts;
|
||||
Touch("last_state_change");
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
double Service::GetLastStateChange(void) const
|
||||
{
|
||||
if (m_LastStateChange.IsEmpty())
|
||||
|
@ -324,18 +243,12 @@ double Service::GetLastStateChange(void) const
|
|||
return m_LastStateChange;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::SetLastHardStateChange(double ts)
|
||||
{
|
||||
m_LastHardStateChange = ts;
|
||||
Touch("last_hard_state_change");
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
double Service::GetLastHardStateChange(void) const
|
||||
{
|
||||
if (m_LastHardStateChange.IsEmpty())
|
||||
|
@ -344,9 +257,6 @@ double Service::GetLastHardStateChange(void) const
|
|||
return m_LastHardStateChange;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
bool Service::GetEnableActiveChecks(void) const
|
||||
{
|
||||
if (m_EnableActiveChecks.IsEmpty())
|
||||
|
@ -355,18 +265,12 @@ bool Service::GetEnableActiveChecks(void) const
|
|||
return m_EnableActiveChecks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::SetEnableActiveChecks(bool enabled)
|
||||
{
|
||||
m_EnableActiveChecks = enabled ? 1 : 0;
|
||||
Touch("enable_active_checks");
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
bool Service::GetEnablePassiveChecks(void) const
|
||||
{
|
||||
if (m_EnablePassiveChecks.IsEmpty())
|
||||
|
@ -375,18 +279,12 @@ bool Service::GetEnablePassiveChecks(void) const
|
|||
return m_EnablePassiveChecks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::SetEnablePassiveChecks(bool enabled)
|
||||
{
|
||||
m_EnablePassiveChecks = enabled ? 1 : 0;
|
||||
Touch("enable_passive_checks");
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
bool Service::GetForceNextCheck(void) const
|
||||
{
|
||||
if (m_ForceNextCheck.IsEmpty())
|
||||
|
@ -395,18 +293,12 @@ bool Service::GetForceNextCheck(void) const
|
|||
return static_cast<bool>(m_ForceNextCheck);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::SetForceNextCheck(bool forced)
|
||||
{
|
||||
m_ForceNextCheck = forced ? 1 : 0;
|
||||
Touch("force_next_check");
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::ProcessCheckResult(const Dictionary::Ptr& cr)
|
||||
{
|
||||
double now = Utility::GetTime();
|
||||
|
@ -569,9 +461,6 @@ void Service::ProcessCheckResult(const Dictionary::Ptr& cr)
|
|||
RequestNotifications(recovery ? NotificationRecovery : NotificationProblem, cr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
ServiceState Service::StateFromString(const String& state)
|
||||
{
|
||||
if (state == "OK")
|
||||
|
@ -586,9 +475,6 @@ ServiceState Service::StateFromString(const String& state)
|
|||
return StateUnknown;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String Service::StateToString(ServiceState state)
|
||||
{
|
||||
switch (state) {
|
||||
|
@ -606,9 +492,6 @@ String Service::StateToString(ServiceState state)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
StateType Service::StateTypeFromString(const String& type)
|
||||
{
|
||||
if (type == "SOFT")
|
||||
|
@ -617,9 +500,6 @@ StateType Service::StateTypeFromString(const String& type)
|
|||
return StateTypeHard;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String Service::StateTypeToString(StateType type)
|
||||
{
|
||||
if (type == StateTypeSoft)
|
||||
|
@ -628,9 +508,6 @@ String Service::StateTypeToString(StateType type)
|
|||
return "HARD";
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
bool Service::IsAllowedChecker(const String& checker) const
|
||||
{
|
||||
Array::Ptr checkers = GetCheckers();
|
||||
|
@ -648,9 +525,6 @@ bool Service::IsAllowedChecker(const String& checker) const
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::BeginExecuteCheck(const boost::function<void (void)>& callback)
|
||||
{
|
||||
ASSERT(!OwnsLock());
|
||||
|
@ -701,9 +575,6 @@ void Service::BeginExecuteCheck(const boost::function<void (void)>& callback)
|
|||
task->Start(boost::bind(&Service::CheckCompletedHandler, self, checkInfo, _1, callback));
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::CheckCompletedHandler(const Dictionary::Ptr& checkInfo,
|
||||
const ScriptTask::Ptr& task, const boost::function<void (void)>& callback)
|
||||
{
|
||||
|
@ -773,9 +644,6 @@ void Service::CheckCompletedHandler(const Dictionary::Ptr& checkInfo,
|
|||
callback();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::UpdateStatistics(const Dictionary::Ptr& cr)
|
||||
{
|
||||
time_t ts;
|
||||
|
@ -792,9 +660,6 @@ void Service::UpdateStatistics(const Dictionary::Ptr& cr)
|
|||
CIB::UpdatePassiveChecksStatistics(ts, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
double Service::CalculateExecutionTime(const Dictionary::Ptr& cr)
|
||||
{
|
||||
double execution_start = 0, execution_end = 0;
|
||||
|
@ -810,9 +675,6 @@ double Service::CalculateExecutionTime(const Dictionary::Ptr& cr)
|
|||
return (execution_end - execution_start);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
double Service::CalculateLatency(const Dictionary::Ptr& cr)
|
||||
{
|
||||
double schedule_start = 0, schedule_end = 0;
|
||||
|
|
|
@ -36,9 +36,6 @@ static bool l_CommentsCacheNeedsUpdate = false;
|
|||
static Timer::Ptr l_CommentsCacheTimer;
|
||||
static Timer::Ptr l_CommentsExpireTimer;
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
int Service::GetNextCommentID(void)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_CommentMutex);
|
||||
|
@ -46,17 +43,11 @@ int Service::GetNextCommentID(void)
|
|||
return l_NextCommentID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Dictionary::Ptr Service::GetComments(void) const
|
||||
{
|
||||
return m_Comments;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String Service::AddComment(CommentType entryType, const String& author,
|
||||
const String& text, double expireTime)
|
||||
{
|
||||
|
@ -97,18 +88,12 @@ String Service::AddComment(CommentType entryType, const String& author,
|
|||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::RemoveAllComments(void)
|
||||
{
|
||||
m_Comments = Empty;
|
||||
Touch("comments");
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::RemoveComment(const String& id)
|
||||
{
|
||||
Service::Ptr owner = GetOwnerByCommentID(id);
|
||||
|
@ -124,9 +109,6 @@ void Service::RemoveComment(const String& id)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String Service::GetCommentIDFromLegacyID(int id)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_CommentMutex);
|
||||
|
@ -139,9 +121,6 @@ String Service::GetCommentIDFromLegacyID(int id)
|
|||
return it->second;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Service::Ptr Service::GetOwnerByCommentID(const String& id)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_CommentMutex);
|
||||
|
@ -149,9 +128,6 @@ Service::Ptr Service::GetOwnerByCommentID(const String& id)
|
|||
return l_CommentsCache[id].lock();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Dictionary::Ptr Service::GetCommentByID(const String& id)
|
||||
{
|
||||
Service::Ptr owner = GetOwnerByCommentID(id);
|
||||
|
@ -167,9 +143,6 @@ Dictionary::Ptr Service::GetCommentByID(const String& id)
|
|||
return Dictionary::Ptr();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
bool Service::IsCommentExpired(const Dictionary::Ptr& comment)
|
||||
{
|
||||
double expire_time = comment->Get("expire_time");
|
||||
|
@ -177,9 +150,6 @@ bool Service::IsCommentExpired(const Dictionary::Ptr& comment)
|
|||
return (expire_time != 0 && expire_time < Utility::GetTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::InvalidateCommentsCache(void)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_CommentMutex);
|
||||
|
@ -197,9 +167,6 @@ void Service::InvalidateCommentsCache(void)
|
|||
l_CommentsCacheNeedsUpdate = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::RefreshCommentsCache(void)
|
||||
{
|
||||
{
|
||||
|
@ -261,9 +228,6 @@ void Service::RefreshCommentsCache(void)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::RemoveExpiredComments(void)
|
||||
{
|
||||
Dictionary::Ptr comments = GetComments();
|
||||
|
@ -293,9 +257,6 @@ void Service::RemoveExpiredComments(void)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::CommentsExpireTimerHandler(void)
|
||||
{
|
||||
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Service")) {
|
||||
|
|
|
@ -36,9 +36,6 @@ static bool l_DowntimesCacheNeedsUpdate = false;
|
|||
static Timer::Ptr l_DowntimesCacheTimer;
|
||||
static Timer::Ptr l_DowntimesExpireTimer;
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
int Service::GetNextDowntimeID(void)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_DowntimeMutex);
|
||||
|
@ -46,17 +43,11 @@ int Service::GetNextDowntimeID(void)
|
|||
return l_NextDowntimeID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Dictionary::Ptr Service::GetDowntimes(void) const
|
||||
{
|
||||
return m_Downtimes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String Service::AddDowntime(const String& author, const String& comment,
|
||||
double startTime, double endTime, bool fixed,
|
||||
const String& triggeredBy, double duration)
|
||||
|
@ -112,9 +103,6 @@ String Service::AddDowntime(const String& author, const String& comment,
|
|||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::RemoveDowntime(const String& id)
|
||||
{
|
||||
Service::Ptr owner = GetOwnerByDowntimeID(id);
|
||||
|
@ -131,9 +119,6 @@ void Service::RemoveDowntime(const String& id)
|
|||
owner->Touch("downtimes");
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::TriggerDowntimes(void)
|
||||
{
|
||||
Dictionary::Ptr downtimes = GetDowntimes();
|
||||
|
@ -158,9 +143,6 @@ void Service::TriggerDowntimes(void)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::TriggerDowntime(const String& id)
|
||||
{
|
||||
Service::Ptr owner = GetOwnerByDowntimeID(id);
|
||||
|
@ -188,9 +170,6 @@ void Service::TriggerDowntime(const String& id)
|
|||
owner->Touch("downtimes");
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String Service::GetDowntimeIDFromLegacyID(int id)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_DowntimeMutex);
|
||||
|
@ -203,18 +182,12 @@ String Service::GetDowntimeIDFromLegacyID(int id)
|
|||
return it->second;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Service::Ptr Service::GetOwnerByDowntimeID(const String& id)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_DowntimeMutex);
|
||||
return l_DowntimesCache[id].lock();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Dictionary::Ptr Service::GetDowntimeByID(const String& id)
|
||||
{
|
||||
Service::Ptr owner = GetOwnerByDowntimeID(id);
|
||||
|
@ -230,9 +203,6 @@ Dictionary::Ptr Service::GetDowntimeByID(const String& id)
|
|||
return Dictionary::Ptr();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
bool Service::IsDowntimeActive(const Dictionary::Ptr& downtime)
|
||||
{
|
||||
double now = Utility::GetTime();
|
||||
|
@ -252,17 +222,11 @@ bool Service::IsDowntimeActive(const Dictionary::Ptr& downtime)
|
|||
return (triggerTime + downtime->Get("duration") < now);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
bool Service::IsDowntimeExpired(const Dictionary::Ptr& downtime)
|
||||
{
|
||||
return (downtime->Get("end_time") < Utility::GetTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::InvalidateDowntimesCache(void)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_DowntimeMutex);
|
||||
|
@ -280,9 +244,6 @@ void Service::InvalidateDowntimesCache(void)
|
|||
l_DowntimesCacheNeedsUpdate = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::RefreshDowntimesCache(void)
|
||||
{
|
||||
{
|
||||
|
@ -343,9 +304,6 @@ void Service::RefreshDowntimesCache(void)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::RemoveExpiredDowntimes(void)
|
||||
{
|
||||
Dictionary::Ptr downtimes = GetDowntimes();
|
||||
|
@ -375,9 +333,6 @@ void Service::RemoveExpiredDowntimes(void)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::DowntimesExpireTimerHandler(void)
|
||||
{
|
||||
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Service")) {
|
||||
|
@ -386,9 +341,6 @@ void Service::DowntimesExpireTimerHandler(void)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
bool Service::IsInDowntime(void) const
|
||||
{
|
||||
Dictionary::Ptr downtimes = GetDowntimes();
|
||||
|
|
|
@ -36,9 +36,6 @@ static std::map<String, std::set<Notification::WeakPtr> > l_NotificationsCache;
|
|||
static bool l_NotificationsCacheNeedsUpdate = false;
|
||||
static Timer::Ptr l_NotificationsCacheTimer;
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::RequestNotifications(NotificationType type, const Dictionary::Ptr& cr)
|
||||
{
|
||||
RequestMessage msg;
|
||||
|
@ -55,9 +52,6 @@ void Service::RequestNotifications(NotificationType type, const Dictionary::Ptr&
|
|||
EndpointManager::GetInstance()->SendAnycastMessage(Endpoint::Ptr(), msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::SendNotifications(NotificationType type, const Dictionary::Ptr& cr)
|
||||
{
|
||||
bool force = false;
|
||||
|
@ -93,9 +87,6 @@ void Service::SendNotifications(NotificationType type, const Dictionary::Ptr& cr
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::InvalidateNotificationsCache(void)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_NotificationMutex);
|
||||
|
@ -113,9 +104,6 @@ void Service::InvalidateNotificationsCache(void)
|
|||
l_NotificationsCacheNeedsUpdate = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::RefreshNotificationsCache(void)
|
||||
{
|
||||
{
|
||||
|
@ -146,9 +134,6 @@ void Service::RefreshNotificationsCache(void)
|
|||
l_NotificationsCache.swap(newNotificationsCache);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
std::set<Notification::Ptr> Service::GetNotifications(void) const
|
||||
{
|
||||
std::set<Notification::Ptr> notifications;
|
||||
|
@ -298,9 +283,6 @@ void Service::UpdateSlaveNotifications(void)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
bool Service::GetEnableNotifications(void) const
|
||||
{
|
||||
if (m_EnableNotifications.IsEmpty())
|
||||
|
@ -309,18 +291,12 @@ bool Service::GetEnableNotifications(void) const
|
|||
return m_EnableNotifications;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::SetEnableNotifications(bool enabled)
|
||||
{
|
||||
m_EnableNotifications = enabled;
|
||||
Touch("enable_notifications");
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
bool Service::GetForceNextNotification(void) const
|
||||
{
|
||||
if (m_ForceNextNotification.IsEmpty())
|
||||
|
@ -329,9 +305,6 @@ bool Service::GetForceNextNotification(void) const
|
|||
return static_cast<bool>(m_ForceNextNotification);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::SetForceNextNotification(bool forced)
|
||||
{
|
||||
m_ForceNextNotification = forced ? 1 : 0;
|
||||
|
|
|
@ -88,9 +88,6 @@ Service::~Service(void)
|
|||
Service::InvalidateCommentsCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::OnRegistrationCompleted(void)
|
||||
{
|
||||
ASSERT(!OwnsLock());
|
||||
|
@ -100,9 +97,6 @@ void Service::OnRegistrationCompleted(void)
|
|||
InvalidateNotificationsCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String Service::GetDisplayName(void) const
|
||||
{
|
||||
if (m_DisplayName.IsEmpty())
|
||||
|
@ -111,9 +105,6 @@ String Service::GetDisplayName(void) const
|
|||
return m_DisplayName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Service::Ptr Service::GetByName(const String& name)
|
||||
{
|
||||
DynamicObject::Ptr configObject = DynamicObject::GetObject("Service", name);
|
||||
|
@ -121,9 +112,6 @@ Service::Ptr Service::GetByName(const String& name)
|
|||
return dynamic_pointer_cast<Service>(configObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Service::Ptr Service::GetByNamePair(const String& hostName, const String& serviceName)
|
||||
{
|
||||
if (!hostName.IsEmpty()) {
|
||||
|
@ -138,57 +126,36 @@ Service::Ptr Service::GetByNamePair(const String& hostName, const String& servic
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Host::Ptr Service::GetHost(void) const
|
||||
{
|
||||
return Host::GetByName(m_HostName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Dictionary::Ptr Service::GetMacros(void) const
|
||||
{
|
||||
return m_Macros;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Array::Ptr Service::GetHostDependencies(void) const
|
||||
{
|
||||
return m_HostDependencies;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Array::Ptr Service::GetServiceDependencies(void) const
|
||||
{
|
||||
return m_ServiceDependencies;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Array::Ptr Service::GetGroups(void) const
|
||||
{
|
||||
return m_ServiceGroups;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String Service::GetHostName(void) const
|
||||
{
|
||||
return m_HostName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String Service::GetShortName(void) const
|
||||
{
|
||||
if (m_ShortName.IsEmpty())
|
||||
|
@ -197,9 +164,6 @@ String Service::GetShortName(void) const
|
|||
return m_ShortName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
bool Service::IsReachable(void) const
|
||||
{
|
||||
ASSERT(!OwnsLock());
|
||||
|
@ -254,9 +218,6 @@ bool Service::IsReachable(void) const
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
AcknowledgementType Service::GetAcknowledgement(void)
|
||||
{
|
||||
ASSERT(OwnsLock());
|
||||
|
@ -280,26 +241,17 @@ AcknowledgementType Service::GetAcknowledgement(void)
|
|||
return avalue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::SetAcknowledgement(AcknowledgementType acknowledgement)
|
||||
{
|
||||
m_Acknowledgement = acknowledgement;
|
||||
Touch("acknowledgement");
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
bool Service::IsAcknowledged(void)
|
||||
{
|
||||
return GetAcknowledgement() != AcknowledgementNone;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
double Service::GetAcknowledgementExpiry(void) const
|
||||
{
|
||||
if (m_AcknowledgementExpiry.IsEmpty())
|
||||
|
@ -308,18 +260,12 @@ double Service::GetAcknowledgementExpiry(void) const
|
|||
return static_cast<double>(m_AcknowledgementExpiry);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::SetAcknowledgementExpiry(double timestamp)
|
||||
{
|
||||
m_AcknowledgementExpiry = timestamp;
|
||||
Touch("acknowledgement_expiry");
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::AcknowledgeProblem(AcknowledgementType type, double expiry)
|
||||
{
|
||||
{
|
||||
|
@ -332,9 +278,6 @@ void Service::AcknowledgeProblem(AcknowledgementType type, double expiry)
|
|||
RequestNotifications(NotificationAcknowledgement, GetLastCheckResult());
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::ClearAcknowledgement(void)
|
||||
{
|
||||
ObjectLock olock(this);
|
||||
|
@ -343,9 +286,6 @@ void Service::ClearAcknowledgement(void)
|
|||
SetAcknowledgementExpiry(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void Service::OnAttributeChanged(const String& name)
|
||||
{
|
||||
ASSERT(!OwnsLock());
|
||||
|
@ -377,9 +317,6 @@ void Service::OnAttributeChanged(const String& name)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
std::set<Host::Ptr> Service::GetParentHosts(void) const
|
||||
{
|
||||
std::set<Host::Ptr> parents;
|
||||
|
@ -408,9 +345,6 @@ std::set<Host::Ptr> Service::GetParentHosts(void) const
|
|||
return parents;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
std::set<Service::Ptr> Service::GetParentServices(void) const
|
||||
{
|
||||
std::set<Service::Ptr> parents;
|
||||
|
@ -435,9 +369,6 @@ std::set<Service::Ptr> Service::GetParentServices(void) const
|
|||
return parents;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Dictionary::Ptr Service::CalculateDynamicMacros(const Dictionary::Ptr& crOverride) const
|
||||
{
|
||||
Dictionary::Ptr macros = boost::make_shared<Dictionary>();
|
||||
|
|
|
@ -48,9 +48,6 @@ ServiceGroup::~ServiceGroup(void)
|
|||
InvalidateMembersCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void ServiceGroup::OnRegistrationCompleted(void)
|
||||
{
|
||||
ASSERT(!OwnsLock());
|
||||
|
@ -58,9 +55,6 @@ void ServiceGroup::OnRegistrationCompleted(void)
|
|||
InvalidateMembersCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String ServiceGroup::GetDisplayName(void) const
|
||||
{
|
||||
if (!m_DisplayName.Get().IsEmpty())
|
||||
|
@ -69,25 +63,16 @@ String ServiceGroup::GetDisplayName(void) const
|
|||
return GetName();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String ServiceGroup::GetNotesUrl(void) const
|
||||
{
|
||||
return m_NotesUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String ServiceGroup::GetActionUrl(void) const
|
||||
{
|
||||
return m_ActionUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
ServiceGroup::Ptr ServiceGroup::GetByName(const String& name)
|
||||
{
|
||||
DynamicObject::Ptr configObject = DynamicObject::GetObject("ServiceGroup", name);
|
||||
|
@ -98,9 +83,6 @@ ServiceGroup::Ptr ServiceGroup::GetByName(const String& name)
|
|||
return dynamic_pointer_cast<ServiceGroup>(configObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
std::set<Service::Ptr> ServiceGroup::GetMembers(void) const
|
||||
{
|
||||
std::set<Service::Ptr> services;
|
||||
|
@ -121,9 +103,6 @@ std::set<Service::Ptr> ServiceGroup::GetMembers(void) const
|
|||
return services;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void ServiceGroup::InvalidateMembersCache(void)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_Mutex);
|
||||
|
@ -141,9 +120,6 @@ void ServiceGroup::InvalidateMembersCache(void)
|
|||
l_MembersCacheNeedsUpdate = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void ServiceGroup::RefreshMembersCache(void)
|
||||
{
|
||||
{
|
||||
|
|
|
@ -57,9 +57,6 @@ void TimePeriod::Start(void)
|
|||
UpdateRegion(now, now + 24 * 3600);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
TimePeriod::Ptr TimePeriod::GetByName(const String& name)
|
||||
{
|
||||
DynamicObject::Ptr configObject = DynamicObject::GetObject("TimePeriod", name);
|
||||
|
|
|
@ -40,9 +40,6 @@ User::~User(void)
|
|||
UserGroup::InvalidateMembersCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void User::OnAttributeChanged(const String& name)
|
||||
{
|
||||
ASSERT(!OwnsLock());
|
||||
|
@ -51,9 +48,6 @@ void User::OnAttributeChanged(const String& name)
|
|||
UserGroup::InvalidateMembersCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
User::Ptr User::GetByName(const String& name)
|
||||
{
|
||||
DynamicObject::Ptr configObject = DynamicObject::GetObject("User", name);
|
||||
|
@ -61,9 +55,6 @@ User::Ptr User::GetByName(const String& name)
|
|||
return dynamic_pointer_cast<User>(configObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String User::GetDisplayName(void) const
|
||||
{
|
||||
if (!m_DisplayName.IsEmpty())
|
||||
|
@ -72,17 +63,11 @@ String User::GetDisplayName(void) const
|
|||
return GetName();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Array::Ptr User::GetGroups(void) const
|
||||
{
|
||||
return m_Groups;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Dictionary::Ptr User::GetMacros(void) const
|
||||
{
|
||||
return m_Macros;
|
||||
|
@ -93,9 +78,6 @@ TimePeriod::Ptr User::GetNotificationPeriod(void) const
|
|||
return TimePeriod::GetByName(m_NotificationPeriod);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
Dictionary::Ptr User::CalculateDynamicMacros(void) const
|
||||
{
|
||||
Dictionary::Ptr macros = boost::make_shared<Dictionary>();
|
||||
|
|
|
@ -45,9 +45,6 @@ UserGroup::~UserGroup(void)
|
|||
InvalidateMembersCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void UserGroup::OnRegistrationCompleted(void)
|
||||
{
|
||||
ASSERT(!OwnsLock());
|
||||
|
@ -55,9 +52,6 @@ void UserGroup::OnRegistrationCompleted(void)
|
|||
InvalidateMembersCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
String UserGroup::GetDisplayName(void) const
|
||||
{
|
||||
if (!m_DisplayName.IsEmpty())
|
||||
|
@ -66,9 +60,6 @@ String UserGroup::GetDisplayName(void) const
|
|||
return GetName();
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
UserGroup::Ptr UserGroup::GetByName(const String& name)
|
||||
{
|
||||
DynamicObject::Ptr configObject = DynamicObject::GetObject("UserGroup", name);
|
||||
|
@ -79,9 +70,6 @@ UserGroup::Ptr UserGroup::GetByName(const String& name)
|
|||
return dynamic_pointer_cast<UserGroup>(configObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
std::set<User::Ptr> UserGroup::GetMembers(void) const
|
||||
{
|
||||
std::set<User::Ptr> users;
|
||||
|
@ -102,9 +90,6 @@ std::set<User::Ptr> UserGroup::GetMembers(void) const
|
|||
return users;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void UserGroup::InvalidateMembersCache(void)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_Mutex);
|
||||
|
@ -122,9 +107,6 @@ void UserGroup::InvalidateMembersCache(void)
|
|||
l_MembersCacheNeedsUpdate = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @threadsafety Always.
|
||||
*/
|
||||
void UserGroup::RefreshMembersCache(void)
|
||||
{
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue