From f9a2f34c358b8f0be2a5b25eb75aae540bd1b7ec Mon Sep 17 00:00:00 2001 From: pradeep Date: Tue, 28 Jan 2003 00:18:25 +0000 Subject: ChangeLogTag: Mon Jan 27 19:16:33 2003 Pradeep Gore --- TAO/ChangeLog | 100 +++++++++++++++++++++ TAO/orbsvcs/orbsvcs/Notify/Builder.cpp | 11 +++ TAO/orbsvcs/orbsvcs/Notify/Container_T.cpp | 20 +++-- TAO/orbsvcs/orbsvcs/Notify/Container_T.h | 2 +- TAO/orbsvcs/orbsvcs/Notify/EventChannel.cpp | 7 +- TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.cpp | 3 +- TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.cpp | 2 +- TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.h | 11 +++ TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.inl | 12 +++ TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.cpp | 4 +- TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.h | 6 +- TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.inl | 16 +++- .../orbsvcs/Notify/Method_Request_Lookup.cpp | 16 +++- TAO/orbsvcs/orbsvcs/Notify/Notify_Service.cpp | 5 ++ TAO/orbsvcs/orbsvcs/Notify/Notify_Service.h | 2 + TAO/orbsvcs/orbsvcs/Notify/Object.cpp | 17 +++- TAO/orbsvcs/orbsvcs/Notify/Object.h | 11 +-- TAO/orbsvcs/orbsvcs/Notify/Object_T.cpp | 23 ++--- TAO/orbsvcs/orbsvcs/Notify/Object_T.h | 10 +-- TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.cpp | 14 +-- TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.h | 2 +- TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.cpp | 12 ++- TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.h | 2 +- TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.cpp | 15 +++- TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.h | 9 +- .../Notify/Sequence/SequencePushConsumer.cpp | 1 + TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.cpp | 31 ++++--- TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.h | 8 +- TAO/orbsvcs/orbsvcs/Notify/Timer.h | 7 +- TAO/orbsvcs/orbsvcs/Notify/Timer_Queue.cpp | 27 ++++-- TAO/orbsvcs/orbsvcs/Notify/Timer_Queue.h | 13 ++- TAO/orbsvcs/orbsvcs/Notify/Timer_Reactor.cpp | 9 ++ TAO/orbsvcs/orbsvcs/Notify/Timer_Reactor.h | 5 ++ TAO/orbsvcs/orbsvcs/Notify/Worker_Task.cpp | 5 -- TAO/orbsvcs/orbsvcs/Notify/Worker_Task.h | 3 - 35 files changed, 341 insertions(+), 100 deletions(-) diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 1455ce29d30..5f75e2014b4 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,103 @@ +Mon Jan 27 19:16:33 2003 Pradeep Gore + + Made the following changes to fix the race related crashes of + Notify seen in orbsvcs/tests/Notify/performance-tests/RedGreen - + + * orbsvcs\orbsvcs\Notify\Builder.cpp: + Added a refcount on each parent object per child object. + This way the parent is always alive when the child is destroyed. + When the child is destroyed, the parent count is decremented. + The ensures a bottom-up destruction of the Notify object tree. + + * orbsvcs\orbsvcs\Notify\Object.cpp: + * orbsvcs\orbsvcs\Notify\Object.h: + Made the TAO_NS_Object class a TAO_NS_Refcountable. Moved the + method to this class from TAO_NS_Object_T. + The method sets the flag atomically. + It returns 1 if this object has been shutdown already. All + derived classes should consult the TAO_NS_Object::shutdown + method's return value to determine if the shutdown should + proceed in case of multiple calls to shutdown. + + * orbsvcs\orbsvcs\Notify\Object_T.cpp: + * orbsvcs\orbsvcs\Notify\Object_T.h: + Decrement the count on this Objects parent in the destructor. + Changed the signature of destroy similar to to avoid + multiple destoy's. + + * orbsvcs\orbsvcs\Notify\Container_T.cpp: + * orbsvcs\orbsvcs\Notify\Container_T.h: + The owned by the Container is destroyed in the + method now. The releases the reference count on child + objects. + + * orbsvcs\orbsvcs\Notify\EventChannel.cpp: + * orbsvcs\orbsvcs\Notify\EventChannelFactory.cpp: + The method checks the return value of base destroy + method before proceeding. + + * orbsvcs\orbsvcs\Notify\Event_Map_Entry_T.cpp: + * orbsvcs\orbsvcs\Notify\Event_Map_Entry_T.h: + * orbsvcs\orbsvcs\Notify\Event_Map_Entry_T.inl: + Made the Event_Map_Entry a refcounted object. + The member is incremented when the method + returns a suitable entry. + The caller is responsible for decrementing the count when it no + longer needs the entry. + + * orbsvcs\orbsvcs\Notify\Event_Map_T.cpp: + * orbsvcs\orbsvcs\Notify\Event_Map_T.h: + * orbsvcs\orbsvcs\Notify\Event_Map_T.inl: + method now returns the entry (from which the collection + can be obtained). + The method decrements the count on the entry instead of + deleteting it. + + * orbsvcs\orbsvcs\Notify\Method_Request_Lookup.cpp: + Obtains the correct map entry and uses the collection in that + entry. The map is released when it is done using it. + Note that the map pointer is guaranteed to be valid because the + Lookup object holds a reference count to the proxy that holds a + count on its parent and so on up to the EventChannel. The + EventChannel only destroys the Event_manager in its destructor. + + * orbsvcs\orbsvcs\Notify\Notify_Service.cpp: + * orbsvcs\orbsvcs\Notify\Notify_Service.h: + Added a fake <_decr_refcnt> to satisfy the template requirements + from TAO_NS_Object_T. This will be rectified in future revisions. + + * orbsvcs\orbsvcs\Notify\ProxyConsumer.cpp: + * orbsvcs\orbsvcs\Notify\ProxyConsumer.h: + * orbsvcs\orbsvcs\Notify\ProxySupplier.cpp: + * orbsvcs\orbsvcs\Notify\ProxySupplier.h: + Modified the implementation to follow the checks as + described above. + + * orbsvcs\orbsvcs\Notify\Timer.h: + * orbsvcs\orbsvcs\Notify\Timer_Reactor.cpp: + * orbsvcs\orbsvcs\Notify\Timer_Reactor.h: + Made the Timer a refcounted object. + + * orbsvcs\orbsvcs\Notify\Timer_Queue.cpp: + * orbsvcs\orbsvcs\Notify\Timer_Queue.h: + Added an method to obtain the timer implementation. + + * orbsvcs\orbsvcs\Notify\Worker_Task.h: + Removed the method which is not required here. + + * orbsvcs\orbsvcs\Notify\Reactive_Task.cpp: + * orbsvcs\orbsvcs\Notify\Reactive_Task.h: + Added an method in which the Reactor based timer is + allocated. + + * orbsvcs\orbsvcs\Notify\ThreadPool_Task.cpp: + * orbsvcs\orbsvcs\Notify\ThreadPool_Task.h: + The Timer Queue is allocated in the method. + + * orbsvcs\orbsvcs\Notify\Sequence\SequencePushConsumer.cpp: + Because the timer is now refcounted, we must release it on + shutdown. + Mon Jan 27 17:36:51 2003 Jeff Parsons * orbsvcs/IFR_Service/ifr_adding_visitor.cpp: diff --git a/TAO/orbsvcs/orbsvcs/Notify/Builder.cpp b/TAO/orbsvcs/orbsvcs/Notify/Builder.cpp index b5c196dea28..f12a6ea898e 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Builder.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Builder.cpp @@ -145,6 +145,7 @@ TAO_NS_Builder::build_event_channel (TAO_NS_EventChannelFactory* ecf, const CosN // set the parent - ec->parent_ = ecf; + ec->parent_->_incr_refcnt (); ec->TAO_NS_Container::init (ecf->object_poa(), 0, ecf->object_poa(), ecf->object_poa()); @@ -209,6 +210,7 @@ TAO_NS_Builder::build_consumer_admin (TAO_NS_EventChannel* ec, CosNotifyChannelA ca->filter_operator (op); ca->parent_ = ec; + ca->parent_->_incr_refcnt (); ca->event_manager_ = ec->event_manager_; ca->admin_properties_ = ec->admin_properties_; @@ -261,6 +263,7 @@ TAO_NS_Builder::build_supplier_admin (TAO_NS_EventChannel* ec, CosNotifyChannelA sa->filter_operator (op); sa->parent_ = ec; + sa->parent_->_incr_refcnt (); sa->event_manager_ = ec->event_manager_; sa->admin_properties_ = ec->admin_properties_; @@ -322,6 +325,7 @@ TAO_NS_Builder::build_notification_push_consumer (TAO_NS_SupplierAdmin* sa, CosN pc->event_manager_ = sa->event_manager_; pc->admin_properties_ = sa->admin_properties_; pc->parent_ = sa; + pc->parent_->_incr_refcnt (); /// self POA, proxy POA pc->init (sa->proxy_poa (), sa->proxy_poa (), sa->worker_task ()); @@ -363,6 +367,7 @@ TAO_NS_Builder::build_notification_push_consumer (TAO_NS_SupplierAdmin* sa, CosN pc->event_manager_ = sa->event_manager_; pc->admin_properties_ = sa->admin_properties_; pc->parent_ = sa; + pc->parent_->_incr_refcnt (); /// self POA, proxy POA pc->init (sa->proxy_poa (), sa->proxy_poa (), sa->worker_task ()); @@ -404,6 +409,7 @@ TAO_NS_Builder::build_notification_push_consumer (TAO_NS_SupplierAdmin* sa, CosN pc->event_manager_ = sa->event_manager_; pc->admin_properties_ = sa->admin_properties_; pc->parent_ = sa; + pc->parent_->_incr_refcnt (); /// self POA, proxy POA pc->init (sa->proxy_poa (), sa->proxy_poa (), sa->worker_task ()); @@ -467,6 +473,7 @@ TAO_NS_Builder::build_notification_push_supplier (TAO_NS_ConsumerAdmin* ca, CosN ps->event_manager_ = ca->event_manager_; ps->admin_properties_ = ca->admin_properties_; ps->parent_ = ca; + ps->parent_->_incr_refcnt (); /// self POA, proxy POA ps->init (ca->proxy_poa (), ca->proxy_poa (), ca->worker_task ()); @@ -510,6 +517,7 @@ TAO_NS_Builder::build_notification_push_supplier (TAO_NS_ConsumerAdmin* ca, CosN ps->event_manager_ = ca->event_manager_; ps->admin_properties_ = ca->admin_properties_; ps->parent_ = ca; + ps->parent_->_incr_refcnt (); /// self POA, proxy POA ps->init (ca->proxy_poa (), ca->proxy_poa (), ca->worker_task ()); @@ -553,6 +561,7 @@ TAO_NS_Builder::build_notification_push_supplier (TAO_NS_ConsumerAdmin* ca, CosN ps->event_manager_ = ca->event_manager_; ps->admin_properties_ = ca->admin_properties_; ps->parent_ = ca; + ps->parent_->_incr_refcnt (); /// self POA, proxy POA ps->init (ca->proxy_poa (), ca->proxy_poa (), ca->worker_task ()); @@ -612,6 +621,7 @@ TAO_NS_Builder::build_push_supplier (TAO_NS_ConsumerAdmin* ca ACE_ENV_ARG_DECL) ps->event_manager_ = ca->event_manager_; ps->admin_properties_ = ca->admin_properties_; ps->parent_ = ca; + ps->parent_->_incr_refcnt (); // self POA, proxy POA ps->init (ca->proxy_poa (), ca->proxy_poa (), ca->worker_task ()); @@ -662,6 +672,7 @@ TAO_NS_Builder::build_push_consumer (TAO_NS_SupplierAdmin* sa ACE_ENV_ARG_DECL) pc->event_manager_ = sa->event_manager_; pc->admin_properties_ = sa->admin_properties_; pc->parent_ = sa; + pc->parent_->_incr_refcnt (); // self POA, proxy POA pc->init (sa->proxy_poa (), sa->proxy_poa (), sa->worker_task ()); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Container_T.cpp b/TAO/orbsvcs/orbsvcs/Notify/Container_T.cpp index f2b0038c852..3004d23da45 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Container_T.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Container_T.cpp @@ -36,25 +36,29 @@ TAO_NS_Container_T::TAO_NS_Container_T (void) template TAO_NS_Container_T::~TAO_NS_Container_T () { - /// - delete collection_; } -template void +template int TAO_NS_Container_T::shutdown (ACE_ENV_SINGLE_ARG_DECL) { - // Destroy the leaves upwards.. + // shutdown baseclass. + if (TAO_NS_Object_T::shutdown (ACE_ENV_SINGLE_ARG_PARAMETER) == 1) + return 1; + + ACE_CHECK_RETURN (1); + // First inform the children. TAO_ESF_Shutdown_Proxy shutdown_worker; this->collection_->for_each (&shutdown_worker ACE_ENV_ARG_PARAMETER); - - // shutdown baseclass. - TAO_NS_Object_T::shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; + ACE_CHECK_RETURN (1); /// shutdown Container this->cleanup (ACE_ENV_SINGLE_ARG_PARAMETER); + + delete collection_; + + return 0; } template void diff --git a/TAO/orbsvcs/orbsvcs/Notify/Container_T.h b/TAO/orbsvcs/orbsvcs/Notify/Container_T.h index da1855da4c1..39f2c88677f 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Container_T.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Container_T.h @@ -84,7 +84,7 @@ public: void init_collection (ACE_ENV_SINGLE_ARG_DECL); /// Shutdown - virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL); + virtual int shutdown (ACE_ENV_SINGLE_ARG_DECL); protected: typedef TAO_ESF_Proxy_Collection COLLECTION; diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventChannel.cpp b/TAO/orbsvcs/orbsvcs/Notify/EventChannel.cpp index 327742e26ef..80bdc5262b1 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventChannel.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/EventChannel.cpp @@ -69,11 +69,10 @@ TAO_NS_EventChannel::destroy (ACE_ENV_SINGLE_ARG_DECL) CORBA::SystemException )) { - this->inherited::destroy (this ACE_ENV_ARG_PARAMETER); - this->event_manager_->shutdown (); + if (this->inherited::destroy (this ACE_ENV_ARG_PARAMETER) == 1) + return; - /* this->default_consumer_admin_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - this->default_supplier_admin_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);*/ + this->event_manager_->shutdown (); } void diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.cpp b/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.cpp index 45e0aa576d5..d1cfc5aece4 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.cpp @@ -67,7 +67,8 @@ TAO_NS_EventChannelFactory::destroy (ACE_ENV_SINGLE_ARG_DECL) CORBA::SystemException )) { - this->inherited::destroy (this ACE_ENV_ARG_PARAMETER); + if (this->inherited::destroy (this ACE_ENV_ARG_PARAMETER) == 1) + return; TAO_NS_Properties* properties = TAO_NS_PROPERTIES::instance(); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.cpp b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.cpp index 625a64f82bb..53573dafa90 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.cpp @@ -17,7 +17,7 @@ ACE_RCSID(Notify, TAO_NS_Event_Map_Entry_T, "$id$") template TAO_NS_Event_Map_Entry_T::TAO_NS_Event_Map_Entry_T (void) - : collection_ (0), count_ (0) + : collection_ (0), count_ (0), usage_count_ (1) { } diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.h b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.h index 566f8b4894d..f9981c0a093 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.h @@ -20,6 +20,7 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Copy_Disabled.h" +#include "ace/Atomic_Op.h" #include "Types.h" template class TAO_NS_Event_Map_T; @@ -57,12 +58,22 @@ public: /// Count accessor int count (void); + ///= Reference counting methods. + // Incr the ref count. + CORBA::ULong _incr_refcnt (void); + + // Decr the ref count. This object is destroyed when the count is 0. + CORBA::ULong _decr_refcnt (void); + protected: /// The Collection COLLECTION* collection_; /// Count of PROXY's connected in the collection; int count_; + + /// Count of users accessing this entry. + ACE_Atomic_Op usage_count_; }; #if defined (__ACE_INLINE__) diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.inl b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.inl index 3d056b5aa4b..b0dfa7c4676 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.inl @@ -11,3 +11,15 @@ TAO_NS_Event_Map_Entry_T::count (void) { return this->count_; } + +template ACE_INLINE CORBA::ULong +TAO_NS_Event_Map_Entry_T::_incr_refcnt (void) +{ + return ++this->usage_count_; +} + +template ACE_INLINE CORBA::ULong +TAO_NS_Event_Map_Entry_T::_decr_refcnt (void) +{ + return --this->usage_count_; +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.cpp b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.cpp index c97cba0453c..fc2ba2f0c71 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.cpp @@ -146,7 +146,9 @@ TAO_NS_Event_Map_T::remove (PROXY* proxy, const TAO_NS_EventTyp ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); this->map_.unbind (event_type); - delete entry; + + if (entry->_decr_refcnt () == 0) + delete entry; if (this->event_types_.remove (event_type) == -1) return -1; diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.h b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.h index ca59364cf11..6fe8b485bb7 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.h @@ -64,7 +64,8 @@ public: int remove (PROXY* proxy, const TAO_NS_EventType& event_type ACE_ENV_ARG_DECL); /// Find the collection mapped to the - ACE_TYPENAME ENTRY::COLLECTION* find (const TAO_NS_EventType& event_type ACE_ENV_ARG_DECL); + /// The usage_count on the entry returned is incremented. + ENTRY* find (const TAO_NS_EventType& event_type ACE_ENV_ARG_DECL); /// Find the default broadcast list. ACE_TYPENAME ENTRY::COLLECTION* broadcast_collection (void); @@ -72,6 +73,9 @@ public: /// Find the update list. This is all the PROXYS connected to this Map. ACE_TYPENAME ENTRY::COLLECTION* updates_collection (void); + /// Release the usage count on this entry. + void release (ENTRY* entry); + /// Access all the event types available const TAO_NS_EventTypeSeq& event_types (void); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.inl b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.inl index 7ea2cedce8c..fb81c86a0b0 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.inl @@ -1,6 +1,6 @@ // $Id$ -template ACE_INLINE ACE_TYPENAME TAO_NS_Event_Map_Entry_T::COLLECTION* +template ACE_INLINE TAO_NS_Event_Map_Entry_T* TAO_NS_Event_Map_T::find (const TAO_NS_EventType& event_type ACE_ENV_ARG_DECL_NOT_USED) { TAO_NS_Event_Map_Entry_T* entry; @@ -8,11 +8,23 @@ TAO_NS_Event_Map_T::find (const TAO_NS_EventType& event_type AC ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, 0); if (map_.find (event_type, entry) == 0) - return entry->collection (); + { + entry->_incr_refcnt (); + return entry; + } else return 0; } +template ACE_INLINE void +TAO_NS_Event_Map_T::release (ENTRY* entry) +{ + ACE_WRITE_GUARD (ACE_LOCK, ace_mon, this->lock_); + + if (entry->_decr_refcnt () == 0) + delete entry; +} + template ACE_INLINE ACE_TYPENAME TAO_NS_Event_Map_Entry_T::COLLECTION* TAO_NS_Event_Map_T::broadcast_collection (void) { diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.cpp b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.cpp index 4a9a7275986..54f9bb38702 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.cpp @@ -51,10 +51,20 @@ TAO_NS_Method_Request_Lookup::execute (ACE_ENV_SINGLE_ARG_DECL) if (val == 0) return 0; - TAO_NS_ProxySupplier_Collection* consumers = map_->find (this->event_->type () ACE_ENV_ARG_PARAMETER); + TAO_NS_Consumer_Map::ENTRY* entry = map_->find (this->event_->type () ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); - if (consumers != 0) - consumers->for_each (this ACE_ENV_ARG_PARAMETER); + TAO_NS_ProxySupplier_Collection* consumers = 0; + + if (entry != 0) + { + consumers = entry->collection (); + + if (consumers != 0) + consumers->for_each (this ACE_ENV_ARG_PARAMETER); + + this->map_->release (entry); + } // Get the default consumers consumers = map_->broadcast_collection (); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.cpp index 0fa7993dcaa..95f798bf589 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.cpp @@ -24,6 +24,11 @@ TAO_NS_Notify_Service::~TAO_NS_Notify_Service () delete builder_; } +void +TAO_NS_Notify_Service::_decr_refcnt (void) +{ +} + int TAO_NS_Notify_Service::init (int argc, char *argv[]) { diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.h b/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.h index 51da268298d..ca29c811bb5 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.h @@ -45,6 +45,8 @@ public: virtual int init (int argc, char *argv[]); virtual int fini (void); + void _decr_refcnt (void); + /// Init virtual void init (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Object.cpp b/TAO/orbsvcs/orbsvcs/Notify/Object.cpp index bff1c6ab139..093c3405e65 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Object.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Object.cpp @@ -48,13 +48,24 @@ TAO_NS_Object::deactivate (ACE_ENV_SINGLE_ARG_DECL) poa_->deactivate (id_ ACE_ENV_ARG_PARAMETER); } -void +int TAO_NS_Object::shutdown (ACE_ENV_SINGLE_ARG_DECL) { + { + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 1); + + if (this->shutdown_ == 1) + return 1; // Another thread has already run shutdown. + + this->shutdown_ = 1; + } + this->deactivate (ACE_ENV_SINGLE_ARG_PARAMETER); this->shutdown_worker_task (); this->shutdown_proxy_poa (); + + return 0; } CORBA::Object_ptr @@ -158,6 +169,9 @@ TAO_NS_Object::apply_reactive_concurrency (ACE_ENV_SINGLE_ARG_DECL) CORBA::NO_MEMORY ()); ACE_CHECK; + worker_task->init (this->admin_properties_ ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + this->worker_task_own (worker_task); } @@ -172,6 +186,7 @@ TAO_NS_Object::apply_thread_pool_concurrency (const NotifyExt::ThreadPoolParams& ACE_CHECK; worker_task->init (tp_params, this->admin_properties_ ACE_ENV_ARG_PARAMETER); + ACE_CHECK; this->worker_task_own (worker_task); } diff --git a/TAO/orbsvcs/orbsvcs/Notify/Object.h b/TAO/orbsvcs/orbsvcs/Notify/Object.h index f32e492f595..5c071d37d48 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Object.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Object.h @@ -25,6 +25,7 @@ #include "Types.h" #include "QoSProperties.h" #include "AdminProperties.h" +#include "Refcountable.h" class TAO_NS_POA_Helper; class TAO_NS_Worker_Task; @@ -45,7 +46,7 @@ typedef CORBA::Long TAO_NS_Object_Id; * @brief Base Object for RT_Notify's CORBA Objects. * */ -class TAO_Notify_Export TAO_NS_Object +class TAO_Notify_Export TAO_NS_Object : public TAO_NS_Refcountable { friend class TAO_NS_Builder; @@ -68,9 +69,6 @@ public: /// Deactivate void deactivate (ACE_ENV_SINGLE_ARG_DECL); - /// Have we been shutdown. returns 1 if shutdown. - int has_shutdown (void); - /// Get CORBA Ref. CORBA::Object_ptr ref (ACE_ENV_SINGLE_ARG_DECL); @@ -96,7 +94,10 @@ public: CosNotification::QoSProperties* get_qos (ACE_ENV_SINGLE_ARG_DECL); /// shutdown - virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL); + virtual int shutdown (ACE_ENV_SINGLE_ARG_DECL); + + /// Have we been shutdown. returns 1 if shutdown. + int has_shutdown (void); /// Set the QoS Properties. virtual void set_qos (const CosNotification::QoSProperties & qos ACE_ENV_ARG_DECL); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Object_T.cpp b/TAO/orbsvcs/orbsvcs/Notify/Object_T.cpp index 9f0293ef589..05ce6cdad63 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Object_T.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Object_T.cpp @@ -21,27 +21,22 @@ TAO_NS_Object_T::TAO_NS_Object_T (void) template TAO_NS_Object_T::~TAO_NS_Object_T () { + if (parent_) + this->parent_-> _decr_refcnt (); } -template void +template int TAO_NS_Object_T::destroy (TYPE *type ACE_ENV_ARG_DECL) { - TAO_NS_Refcountable_Guard ref_guard(*this); // Protect this object from being destroyed in the middle of its shutdown sequence. - - { - ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); - - if (this->shutdown_ == 1) - return; // Another thread has already run shutdown. + if (this->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER) == 1) + return 1; - this->shutdown_ = 1; - } - - this->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; + ACE_CHECK_RETURN (1); if (parent_) - parent_->remove (type ACE_ENV_ARG_PARAMETER); + this->parent_->remove (type ACE_ENV_ARG_PARAMETER); + + return 0; } #endif /* TAO_NS_OBJECT_T_CPP */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Object_T.h b/TAO/orbsvcs/orbsvcs/Notify/Object_T.h index 77464132cc9..342ee062588 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Object_T.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Object_T.h @@ -20,7 +20,6 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "Object.h" -#include "Refcountable.h" /** * @class TAO_NS_Object_T @@ -29,7 +28,7 @@ * */ template -class TAO_NS_Object_T : public virtual TAO_NS_Object, public TAO_NS_Refcountable +class TAO_NS_Object_T : public virtual TAO_NS_Object { public: /// Constuctor @@ -38,17 +37,14 @@ public: /// Destructor virtual ~TAO_NS_Object_T (); - /// destroy - void destroy (TYPE* type ACE_ENV_ARG_DECL); + /// destroy . returns 1 if already run destroy. + int destroy (TYPE* type ACE_ENV_ARG_DECL); protected: /// = Data Members /// Parent PARENT* parent_; - - /// Are we shutdown (i,e. scheduled for destroy). - int shutdown_; }; #if defined (__ACE_INLINE__) diff --git a/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.cpp index 1a77352d002..cd7bfab096a 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.cpp @@ -98,17 +98,21 @@ TAO_NS_ProxyConsumer::disconnect (ACE_ENV_SINGLE_ARG_DECL) this->admin_properties_->suppliers ()--; } -void +int TAO_NS_ProxyConsumer::shutdown (ACE_ENV_SINGLE_ARG_DECL) { - this->disconnect (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; + if (this->inherited::shutdown (ACE_ENV_SINGLE_ARG_PARAMETER) == 1) + return 1; - this->inherited::shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; + ACE_CHECK_RETURN (1); + + this->disconnect (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (1); if (this->supplier_ != 0) this->supplier_->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); + + return 0; } void diff --git a/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.h index 30852afa1f4..976e82d8b99 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.h @@ -51,7 +51,7 @@ public: void disconnect (ACE_ENV_SINGLE_ARG_DECL); /// Shutdown (TAO_NS_Container_T method) - virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL); + virtual int shutdown (ACE_ENV_SINGLE_ARG_DECL); /// Start event propagation. virtual void push (TAO_NS_Event_var &event); diff --git a/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.cpp index bb2ce06da5f..cb24b194385 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.cpp @@ -101,15 +101,21 @@ TAO_NS_ProxySupplier::disconnect (ACE_ENV_SINGLE_ARG_DECL) this->admin_properties_->consumers ()--; } -void +int TAO_NS_ProxySupplier::shutdown (ACE_ENV_SINGLE_ARG_DECL) { - this->disconnect (ACE_ENV_SINGLE_ARG_PARAMETER); + if (this->inherited::shutdown (ACE_ENV_SINGLE_ARG_PARAMETER) == 1) + return 1; - this->inherited::shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (1); + + this->disconnect (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (1); if (this->consumer_ != 0) this->consumer_->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); + + return 0; } void diff --git a/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.h b/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.h index 50d3ed4a700..102ce63077d 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.h @@ -61,7 +61,7 @@ public: virtual void push_no_filtering (const TAO_NS_Event_var &event); /// Override TAO_NS_Container_T::shutdown method - virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL); + virtual int shutdown (ACE_ENV_SINGLE_ARG_DECL); /// Override, TAO_NS_Proxy::qos_changed to apply MaxEventssPerConsumer QoS. virtual void qos_changed (const TAO_NS_QoSProperties& qos_properties); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.cpp b/TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.cpp index 2f0794d0b48..773348648c7 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.cpp @@ -8,7 +8,10 @@ ACE_RCSID(RT_Notify, TAO_NS_Reactive_Task, "$Id$") +#include "Timer_Reactor.h" + TAO_NS_Reactive_Task::TAO_NS_Reactive_Task (void) + :timer_ (0) { } @@ -16,9 +19,18 @@ TAO_NS_Reactive_Task::~TAO_NS_Reactive_Task () { } +void +TAO_NS_Reactive_Task::init (TAO_NS_AdminProperties_var& /*admin_properties*/ ACE_ENV_ARG_DECL) +{ + ACE_NEW_THROW_EX (this->timer_, + TAO_NS_Timer_Reactor (), + CORBA::NO_MEMORY ()); +} + void TAO_NS_Reactive_Task::shutdown (void) { + this->timer_->_decr_refcnt (); delete this; //TODO: Release via factory. } @@ -32,5 +44,6 @@ TAO_NS_Reactive_Task::exec (TAO_NS_Method_Request& method_request) TAO_NS_Timer* TAO_NS_Reactive_Task::timer (void) { - return &this->timer_; + this->timer_->_incr_refcnt (); + return this->timer_; } diff --git a/TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.h b/TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.h index bbc13e3bf33..f4f8efcf536 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.h @@ -20,7 +20,9 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "Worker_Task.h" -#include "Timer_Reactor.h" +#include "AdminProperties.h" + +class TAO_NS_Timer_Reactor; /** * @class TAO_NS_Reactive_Task @@ -37,6 +39,9 @@ public: /// Destructor ~TAO_NS_Reactive_Task (); + /// Init the reactive task. + void init (TAO_NS_AdminProperties_var& admin_properties ACE_ENV_ARG_DECL); + /// Shutdown task virtual void shutdown (void); @@ -51,7 +56,7 @@ public: protected: /// The timer. - TAO_NS_Timer_Reactor timer_; + TAO_NS_Timer_Reactor* timer_; }; #if defined (__ACE_INLINE__) diff --git a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushConsumer.cpp index 9d099aa2269..36abbc2ba37 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushConsumer.cpp @@ -47,6 +47,7 @@ void TAO_NS_SequencePushConsumer::shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) { this->cancel_timer (); + this->timer_->_decr_refcnt (); } void diff --git a/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.cpp b/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.cpp index 28f19ec432b..feebf2fbf59 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.cpp @@ -10,10 +10,10 @@ ACE_RCSID(RT_Notify, TAO_NS_ThreadPool_Task, "$Id$") #include "tao/debug.h" #include "Properties.h" -#include "AdminProperties.h" +#include "Timer_Queue.h" TAO_NS_ThreadPool_Task::TAO_NS_ThreadPool_Task (void) - : buffering_strategy_ (0), shutdown_ (0) + : buffering_strategy_ (0), shutdown_ (0), timer_ (0) { } @@ -28,24 +28,27 @@ TAO_NS_ThreadPool_Task::init (int argc, char **argv) return this->ACE_Task::init (argc, argv); } -void -TAO_NS_ThreadPool_Task::init (TAO_NS_AdminProperties &p) -{ - // Call the base class implementation - TAO_NS_Worker_Task::init (p); -} + TAO_NS_Timer* TAO_NS_ThreadPool_Task::timer (void) { - return &this->timer_; + this->timer_->_incr_refcnt (); + + return this->timer_; } void TAO_NS_ThreadPool_Task::init (const NotifyExt::ThreadPoolParams& tp_params, TAO_NS_AdminProperties_var& admin_properties ACE_ENV_ARG_DECL) { + ACE_NEW_THROW_EX (this->timer_, + TAO_NS_Timer_Queue (), + CORBA::NO_MEMORY ()); + ACE_CHECK; + ACE_NEW_THROW_EX (this->buffering_strategy_, TAO_NS_Buffering_Strategy (*msg_queue (), admin_properties, 1), CORBA::NO_MEMORY ()); + ACE_CHECK; long flags = THR_NEW_LWP | THR_JOINABLE; @@ -99,9 +102,9 @@ TAO_NS_ThreadPool_Task::svc (void) ACE_Time_Value* dequeue_blocking_time = 0; ACE_Time_Value earliest_time; - if (!this->timer_.timer_queue_->is_empty ()) + if (!this->timer_->impl().is_empty ()) { - earliest_time = this->timer_.timer_queue_->earliest_time (); + earliest_time = this->timer_->impl().earliest_time (); dequeue_blocking_time = &earliest_time; } @@ -117,7 +120,7 @@ TAO_NS_ThreadPool_Task::svc (void) } else if (errno == ETIME) { - this->timer_.timer_queue_->expire (); + this->timer_->impl ().expire (); } else if (result == -1) { @@ -150,7 +153,11 @@ int TAO_NS_ThreadPool_Task::close (u_long /*flags*/) { if (this->thr_count () == 0) + { + this->timer_->_decr_refcnt (); + delete this; + } return 0; } diff --git a/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.h b/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.h index 9392b31299f..72fc655bda1 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.h +++ b/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.h @@ -24,10 +24,9 @@ #include "ace/Reactor.h" #include "AdminProperties.h" #include "Worker_Task.h" -#include "Types.h" -#include "Timer_Queue.h" class TAO_NS_Buffering_Strategy; +class TAO_NS_Timer_Queue; /** * @class TAO_NS_ThreadPool_Task @@ -49,9 +48,6 @@ public: /// Call the base class init virtual int init (int argc, char **argv); - /// Call the base class init - virtual void init (TAO_NS_AdminProperties&); - virtual int close (u_long flags); /// Activate the threadpool @@ -84,7 +80,7 @@ private: int shutdown_; /// The Queue based timer. - TAO_NS_Timer_Queue timer_; + TAO_NS_Timer_Queue* timer_; }; #if defined (__ACE_INLINE__) diff --git a/TAO/orbsvcs/orbsvcs/Notify/Timer.h b/TAO/orbsvcs/orbsvcs/Notify/Timer.h index aa03305f07f..84423f943d6 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Timer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Timer.h @@ -20,6 +20,8 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Time_Value.h" +#include "Refcountable.h" + class ACE_Event_Handler; /** @@ -28,9 +30,12 @@ class ACE_Event_Handler; * @brief Interface for scheduling timers. * */ -class TAO_Notify_Export TAO_NS_Timer +class TAO_Notify_Export TAO_NS_Timer : public TAO_NS_Refcountable { public: + /// Destructor + virtual ~TAO_NS_Timer (){}; + /// Schedule a timer virtual long schedule_timer (ACE_Event_Handler *handler, const ACE_Time_Value &delay_time, diff --git a/TAO/orbsvcs/orbsvcs/Notify/Timer_Queue.cpp b/TAO/orbsvcs/orbsvcs/Notify/Timer_Queue.cpp index c5941c107d8..b7d4bbcd16e 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Timer_Queue.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Timer_Queue.cpp @@ -1,7 +1,6 @@ // $Id$ #include "Timer_Queue.h" -#include "ace/Timer_Heap.h" #if ! defined (__ACE_INLINE__) #include "Timer_Queue.inl" @@ -11,13 +10,19 @@ ACE_RCSID(Notify, TAO_NS_Timer_Queue, "$id$") TAO_NS_Timer_Queue::TAO_NS_Timer_Queue (void) - :timer_queue_ (new ACE_Timer_Heap ()) { + this->destroy_callback (this); } TAO_NS_Timer_Queue::~TAO_NS_Timer_Queue () { - delete timer_queue_; +} + +void +TAO_NS_Timer_Queue::release (void) +{ + delete this; + //@@ inform factory } long @@ -25,14 +30,20 @@ TAO_NS_Timer_Queue::schedule_timer (ACE_Event_Handler *handler, const ACE_Time_Value &delay_time, const ACE_Time_Value &interval) { - return this->timer_queue_->schedule (handler, - 0, - timer_queue_->gettimeofday () + delay_time, - interval); + return this->timer_queue_.schedule (handler, + 0, + timer_queue_.gettimeofday () + delay_time, + interval); } int TAO_NS_Timer_Queue::cancel_timer (long timer_id) { - return this->timer_queue_->cancel (timer_id); + return this->timer_queue_.cancel (timer_id); +} + +ACE_Timer_Queue& +TAO_NS_Timer_Queue::impl (void) +{ + return this->timer_queue_; } diff --git a/TAO/orbsvcs/orbsvcs/Notify/Timer_Queue.h b/TAO/orbsvcs/orbsvcs/Notify/Timer_Queue.h index 39f4e354165..3e8bbdb30f3 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Timer_Queue.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Timer_Queue.h @@ -20,8 +20,10 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "Timer.h" +#include "Destroy_Callback.h" #include "ace/Timer_Queue.h" +#include "ace/Timer_Heap.h" /** * @class TAO_NS_Timer_Queue @@ -30,9 +32,8 @@ * */ class TAO_Notify_Export TAO_NS_Timer_Queue : public TAO_NS_Timer + , public TAO_NS_Destroy_Callback { - friend class TAO_NS_ThreadPool_Task; - public: /// Constuctor TAO_NS_Timer_Queue (void); @@ -40,6 +41,9 @@ public: /// Destructor virtual ~TAO_NS_Timer_Queue (); + /// TAO_NS_Destroy_Callback methods + virtual void release (void); + /// Schedule a timer virtual long schedule_timer (ACE_Event_Handler *handler, const ACE_Time_Value &delay_time, @@ -48,9 +52,12 @@ public: /// Cancel Timer virtual int cancel_timer (long timer_id); + /// Get the native impl. + ACE_Timer_Queue& impl (void); + protected: /// The Timer Queue - ACE_Timer_Queue* timer_queue_; + ACE_Timer_Heap timer_queue_; }; #if defined (__ACE_INLINE__) diff --git a/TAO/orbsvcs/orbsvcs/Notify/Timer_Reactor.cpp b/TAO/orbsvcs/orbsvcs/Notify/Timer_Reactor.cpp index a59dc99275c..6e57a1cdd62 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Timer_Reactor.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Timer_Reactor.cpp @@ -15,6 +15,8 @@ ACE_RCSID(Notify, TAO_NS_Timer_Reactor, "$id$") TAO_NS_Timer_Reactor::TAO_NS_Timer_Reactor (void) :reactor_ (0) { + this->destroy_callback (this); + // Get the ORB CORBA::ORB_var orb = TAO_NS_PROPERTIES::instance()->orb (); @@ -25,6 +27,13 @@ TAO_NS_Timer_Reactor::~TAO_NS_Timer_Reactor () { } +void +TAO_NS_Timer_Reactor::release (void) +{ + delete this; + //@@ inform factory +} + long TAO_NS_Timer_Reactor::schedule_timer (ACE_Event_Handler *handler, const ACE_Time_Value &delay_time, diff --git a/TAO/orbsvcs/orbsvcs/Notify/Timer_Reactor.h b/TAO/orbsvcs/orbsvcs/Notify/Timer_Reactor.h index 585d00d7079..eb0cb6e40d2 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Timer_Reactor.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Timer_Reactor.h @@ -20,6 +20,7 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "Timer.h" +#include "Destroy_Callback.h" class ACE_Reactor; @@ -30,6 +31,7 @@ class ACE_Reactor; * */ class TAO_Notify_Export TAO_NS_Timer_Reactor : public TAO_NS_Timer + , public TAO_NS_Destroy_Callback { public: /// Constuctor @@ -38,6 +40,9 @@ public: /// Destructor virtual ~TAO_NS_Timer_Reactor (); + /// TAO_NS_Destroy_Callback methods + virtual void release (void); + /// Schedule a timer virtual long schedule_timer (ACE_Event_Handler *handler, const ACE_Time_Value &delay_time, diff --git a/TAO/orbsvcs/orbsvcs/Notify/Worker_Task.cpp b/TAO/orbsvcs/orbsvcs/Notify/Worker_Task.cpp index 1b758280615..ae9f9efab55 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Worker_Task.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Worker_Task.cpp @@ -16,11 +16,6 @@ TAO_NS_Worker_Task::~TAO_NS_Worker_Task () { } -void -TAO_NS_Worker_Task::init (TAO_NS_AdminProperties& /*admin_properties*/) -{ -} - void TAO_NS_Worker_Task::update_qos_properties (const TAO_NS_QoSProperties& /*qos_properties*/) { diff --git a/TAO/orbsvcs/orbsvcs/Notify/Worker_Task.h b/TAO/orbsvcs/orbsvcs/Notify/Worker_Task.h index f9610fc4205..1e31b5d9732 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Worker_Task.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Worker_Task.h @@ -41,9 +41,6 @@ public: /// Constuctor TAO_NS_Worker_Task (void); - /// Init AdminProperties - virtual void init (TAO_NS_AdminProperties& admin_properties); - /// Update QoS Properties. virtual void update_qos_properties (const TAO_NS_QoSProperties& qos_properties); -- cgit v1.2.1