diff options
Diffstat (limited to 'ace/Logging_Strategy.cpp')
-rw-r--r-- | ace/Logging_Strategy.cpp | 49 |
1 files changed, 44 insertions, 5 deletions
diff --git a/ace/Logging_Strategy.cpp b/ace/Logging_Strategy.cpp index f4270527e02..d7cb0001293 100644 --- a/ace/Logging_Strategy.cpp +++ b/ace/Logging_Strategy.cpp @@ -386,11 +386,6 @@ ACE_Logging_Strategy::init (int argc, ACE_TCHAR *argv[]) if (this->reactor () == 0) // Use singleton. this->reactor (ACE_Reactor::instance ()); - - this->reactor ()->schedule_timer - (this, 0, - ACE_Time_Value (this->interval_), - ACE_Time_Value (this->interval_)); } } // Now set the flags for Log_Msg @@ -551,6 +546,43 @@ ACE_Logging_Strategy::handle_timeout (const ACE_Time_Value &, return 0; } +int +ACE_Logging_Strategy::handle_close (ACE_HANDLE, + ACE_Reactor_Mask) +{ + // This will reset reactor member and cancel timer events. + this->reactor (0); + return 0; +} + +void +ACE_Logging_Strategy::reactor (ACE_Reactor *r) +{ + if (this->reactor () != r) + { + if (this->reactor () && this->interval_ > 0 && this->max_size_ > 0) + { + this->reactor ()->cancel_timer (this); + } + + ACE_Service_Object::reactor (r); + + if (this->reactor ()) + { + this->reactor ()->schedule_timer + (this, 0, + ACE_Time_Value (this->interval_), + ACE_Time_Value (this->interval_)); + } + } +} + +ACE_Reactor * +ACE_Logging_Strategy::reactor (void) const +{ + return ACE_Service_Object::reactor (); +} + void ACE_Logging_Strategy::log_msg (ACE_Log_Msg *log_msg) { @@ -563,4 +595,11 @@ ACE_END_VERSIONED_NAMESPACE_DECL // svc.conf file to dynamically initialize the state of the // Logging_Strategy. +ACE_STATIC_SVC_DEFINE (ACE_Logging_Strategy, + ACE_TEXT ("Logging_Strategy"), + ACE_Service_Type::SERVICE_OBJECT, + &ACE_SVC_NAME (ACE_Logging_Strategy), + ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, + 0) + ACE_FACTORY_DEFINE (ACE, ACE_Logging_Strategy) |