summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpradeep <pradeep@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-01-28 00:18:25 +0000
committerpradeep <pradeep@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-01-28 00:18:25 +0000
commitf9a2f34c358b8f0be2a5b25eb75aae540bd1b7ec (patch)
treecc82a658f16806f4742aebc49fa2fa281ed37b21
parentc40d61037db77a9bd2b902d99f5eb36eb1e7f0ff (diff)
downloadATCD-f9a2f34c358b8f0be2a5b25eb75aae540bd1b7ec.tar.gz
ChangeLogTag: Mon Jan 27 19:16:33 2003 Pradeep Gore <pradeep@oomworks.com>
-rw-r--r--TAO/ChangeLog100
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Builder.cpp11
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Container_T.cpp20
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Container_T.h2
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/EventChannel.cpp7
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.cpp3
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.cpp2
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.h11
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.inl12
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.cpp4
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.h6
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.inl16
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.cpp16
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Notify_Service.cpp5
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Notify_Service.h2
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Object.cpp17
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Object.h11
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Object_T.cpp23
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Object_T.h10
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.cpp14
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.h2
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.cpp12
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.h2
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.cpp15
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.h9
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushConsumer.cpp1
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.cpp31
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.h8
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Timer.h7
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Timer_Queue.cpp27
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Timer_Queue.h13
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Timer_Reactor.cpp9
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Timer_Reactor.h5
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Worker_Task.cpp5
-rw-r--r--TAO/orbsvcs/orbsvcs/Notify/Worker_Task.h3
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 <pradeep@oomworks.com>
+
+ 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
+ <has_shutdown> method to this class from TAO_NS_Object_T.
+ The <shutdown> method sets the <shutdown_> 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 <shutdown> to avoid
+ multiple destoy's.
+
+ * orbsvcs\orbsvcs\Notify\Container_T.cpp:
+ * orbsvcs\orbsvcs\Notify\Container_T.h:
+ The <collection_> owned by the Container is destroyed in the
+ <shutdown> method now. The releases the reference count on child
+ objects.
+
+ * orbsvcs\orbsvcs\Notify\EventChannel.cpp:
+ * orbsvcs\orbsvcs\Notify\EventChannelFactory.cpp:
+ The <destroy> 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 <usage_count_> member is incremented when the <find> 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:
+ <find> method now returns the entry (from which the collection
+ can be obtained).
+ The <remove> 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 <shutdown> 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 <impl> method to obtain the timer implementation.
+
+ * orbsvcs\orbsvcs\Notify\Worker_Task.h:
+ Removed the <init> method which is not required here.
+
+ * orbsvcs\orbsvcs\Notify\Reactive_Task.cpp:
+ * orbsvcs\orbsvcs\Notify\Reactive_Task.h:
+ Added an <init> 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 <init> 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 <j.parsons@vanderbilt.edu>
* 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<TYPE, OBJECT, PARENT>::TAO_NS_Container_T (void)
template<class TYPE, class OBJECT, class PARENT>
TAO_NS_Container_T<TYPE, OBJECT, PARENT>::~TAO_NS_Container_T ()
{
- ///
- delete collection_;
}
-template <class TYPE, class OBJECT, class PARENT> void
+template <class TYPE, class OBJECT, class PARENT> int
TAO_NS_Container_T<TYPE, OBJECT, PARENT>::shutdown (ACE_ENV_SINGLE_ARG_DECL)
{
- // Destroy the leaves upwards..
+ // shutdown baseclass.
+ if (TAO_NS_Object_T<OBJECT, PARENT>::shutdown (ACE_ENV_SINGLE_ARG_PARAMETER) == 1)
+ return 1;
+
+ ACE_CHECK_RETURN (1);
+
// First inform the children.
TAO_ESF_Shutdown_Proxy<TYPE> shutdown_worker;
this->collection_->for_each (&shutdown_worker ACE_ENV_ARG_PARAMETER);
-
- // shutdown baseclass.
- TAO_NS_Object_T<OBJECT, PARENT>::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<class TYPE, class OBJECT, class PARENT> 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<TYPE> 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 <class PROXY>
TAO_NS_Event_Map_Entry_T<PROXY>::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 PROXY, class ACE_LOCK> 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<TAO_SYNCH_MUTEX,int> 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<PROXY>::count (void)
{
return this->count_;
}
+
+template <class PROXY> ACE_INLINE CORBA::ULong
+TAO_NS_Event_Map_Entry_T<PROXY>::_incr_refcnt (void)
+{
+ return ++this->usage_count_;
+}
+
+template <class PROXY> ACE_INLINE CORBA::ULong
+TAO_NS_Event_Map_Entry_T<PROXY>::_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<PROXY, ACE_LOCK>::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 <event_type>
- 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 <class PROXY, class ACE_LOCK> ACE_INLINE ACE_TYPENAME TAO_NS_Event_Map_Entry_T<PROXY>::COLLECTION*
+template <class PROXY, class ACE_LOCK> ACE_INLINE TAO_NS_Event_Map_Entry_T<PROXY>*
TAO_NS_Event_Map_T<PROXY, ACE_LOCK>::find (const TAO_NS_EventType& event_type ACE_ENV_ARG_DECL_NOT_USED)
{
TAO_NS_Event_Map_Entry_T<PROXY>* entry;
@@ -8,11 +8,23 @@ TAO_NS_Event_Map_T<PROXY, ACE_LOCK>::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 <class PROXY, class ACE_LOCK> ACE_INLINE void
+TAO_NS_Event_Map_T<PROXY, ACE_LOCK>::release (ENTRY* entry)
+{
+ ACE_WRITE_GUARD (ACE_LOCK, ace_mon, this->lock_);
+
+ if (entry->_decr_refcnt () == 0)
+ delete entry;
+}
+
template <class PROXY, class ACE_LOCK> ACE_INLINE ACE_TYPENAME TAO_NS_Event_Map_Entry_T<PROXY>::COLLECTION*
TAO_NS_Event_Map_T<PROXY, ACE_LOCK>::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<TYPE, PARENT>::TAO_NS_Object_T (void)
template <class TYPE, class PARENT>
TAO_NS_Object_T<TYPE, PARENT>::~TAO_NS_Object_T ()
{
+ if (parent_)
+ this->parent_-> _decr_refcnt ();
}
-template <class TYPE, class PARENT> void
+template <class TYPE, class PARENT> int
TAO_NS_Object_T<TYPE, PARENT>::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 TYPE, class PARENT>
-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 <type>
- void destroy (TYPE* type ACE_ENV_ARG_DECL);
+ /// destroy <type>. 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)
{
}
@@ -17,8 +20,17 @@ 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<ACE_NULL_SYNCH>::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
@@ -17,11 +17,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);