diff options
author | pradeep <pradeep@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-01-16 22:26:55 +0000 |
---|---|---|
committer | pradeep <pradeep@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-01-16 22:26:55 +0000 |
commit | fbf044a3b5ee56f8c888871165ef806651b90767 (patch) | |
tree | 88f6f230fd4d9ec9c714237c8e7fbd32920f6eea | |
parent | 9dbf45547867047371c4c89663c36165bc01a38c (diff) | |
download | ATCD-fbf044a3b5ee56f8c888871165ef806651b90767.tar.gz |
ChangeLogTag: Thu Jan 16 17:24:30 2003 Pradeep Gore <pradeep@oomworks.com>
-rw-r--r-- | TAO/ChangeLog | 43 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.cpp | 2 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.h | 15 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.cpp | 19 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.h | 9 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Notify/EventType.cpp | 3 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Notify/EventType.h | 2 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.cpp | 2 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.h | 2 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Notify/Object.cpp | 1 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Notify/Object_T.cpp | 9 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Notify/Object_T.h | 3 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Notify/Peer.cpp | 5 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Notify/Properties.h | 8 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Notify/Proxy.cpp | 11 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Notify/Proxy.h | 4 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Notify/Proxy.inl | 6 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/NotifyExt.idl | 10 |
18 files changed, 133 insertions, 21 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index d8aad045072..b2268d93041 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,46 @@ +Thu Jan 16 17:24:30 2003 Pradeep Gore <pradeep@oomworks.com> + + * orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.cpp: + * orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.h: + Make the FilterFactory a RefCounted servant. + This allows us to cleanup this object when the ChannelFactory + dies. + + * orbsvcs/orbsvcs/NotifyExt.idl: + * orbsvcs/orbsvcs/Notify/EventChannelFactory.cpp: + * orbsvcs/orbsvcs/Notify/EventChannelFactory.h: + Extend the ChannelFactory interface to include a destroy method. + This allows us to check for memory leaks using a tool like + purify when the channel factory is destroyed. + + * orbsvcs/orbsvcs/Notify/EventType.cpp: + * orbsvcs/orbsvcs/Notify/EventType.h: + * orbsvcs/orbsvcs/Notify/EventTypeSeq.cpp: + * orbsvcs/orbsvcs/Notify/EventTypeSeq.h: + Made the <dump> methods const. + + * orbsvcs/orbsvcs/Notify/Object.cpp: + * orbsvcs/orbsvcs/Notify/Object_T.cpp: + * orbsvcs/orbsvcs/Notify/Object_T.h: + The <shutdown_> flag is now set in the Object_T::destroy method. + Note that if multiple threads that encounter dispatch failure + try to destroy the proxy object, only the first one will run the + destroy method, others will check for the shutdown flag and + return. This fixes the random crashes in some of the Linux + builds on the scoreboard (orbsvcs/tests/Notify/MT_Dispatching). + + * orbsvcs/orbsvcs/Notify/Proxy.cpp: + * orbsvcs/orbsvcs/Notify/Proxy.h: + Changed the <subscribed_types> method to return a copy of the + curent subscriptions. This method has been corrected to be + thread safe. + + * orbsvcs/orbsvcs/Notify/Peer.cpp: + Changed to new usage of Proxy::subscribed_types. + + * orbsvcs/orbsvcs/Notify/Properties.h: + Use TAO_Singleton instead of ACE_Singleton. + Thu Jan 16 16:27:59 2003 Balachandran Natarajan <bala@isis-server.isis.vanderbilt.edu> * orbsvcs/orbsvcs/Event/EC_Gateway_UDP.{h,cpp}: Added patches from diff --git a/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.cpp b/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.cpp index c4bef12bb38..d88d0c65a64 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.cpp @@ -21,6 +21,8 @@ TAO_NS_ETCL_FilterFactory::~TAO_NS_ETCL_FilterFactory () CosNotifyFilter::FilterFactory_ptr TAO_NS_ETCL_FilterFactory::create (ACE_ENV_SINGLE_ARG_DECL) { + PortableServer::ServantBase_var servant_var (this); + return _this (ACE_ENV_SINGLE_ARG_PARAMETER); } diff --git a/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.h b/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.h index 8db09cbd64b..d1ab3e4910b 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.h +++ b/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.h @@ -22,13 +22,22 @@ #include "orbsvcs/CosNotifyFilterS.h" #include "FilterFactory.h" +#if defined(_MSC_VER) +#if (_MSC_VER >= 1200) +#pragma warning(push) +#endif /* _MSC_VER >= 1200 */ +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + /** * @class TAO_NS_ETCL_FilterFactory * * @brief * */ -class TAO_Notify_Export TAO_NS_ETCL_FilterFactory : public POA_CosNotifyFilter::FilterFactory, public TAO_NS_FilterFactory +class TAO_Notify_Export TAO_NS_ETCL_FilterFactory : public virtual PortableServer::RefCountServantBase + , public virtual POA_CosNotifyFilter::FilterFactory + , public TAO_NS_FilterFactory { public: /// Constuctor @@ -61,6 +70,10 @@ public: )); }; +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +#pragma warning(pop) +#endif /* _MSC_VER */ + ACE_FACTORY_DECLARE (TAO_Notify, TAO_NS_ETCL_FilterFactory) #if defined (__ACE_INLINE__) diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.cpp b/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.cpp index a7ca15ded36..45e0aa576d5 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.cpp @@ -61,6 +61,25 @@ TAO_NS_EventChannelFactory::get_default_filter_factory (ACE_ENV_SINGLE_ARG_DECL_ return CosNotifyFilter::FilterFactory::_duplicate (this->default_filter_factory_.in ()); } +void +TAO_NS_EventChannelFactory::destroy (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + this->inherited::destroy (this ACE_ENV_ARG_PARAMETER); + + TAO_NS_Properties* properties = TAO_NS_PROPERTIES::instance(); + + // Shutdown the ORB. + CORBA::ORB_var orb = properties->orb (); + orb->shutdown (); + + // Reset references to CORBA objects. + properties->orb (CORBA::ORB::_nil ()); + properties->default_poa (PortableServer::POA::_nil ()); +} + ::CosNotifyChannelAdmin::EventChannel_ptr TAO_NS_EventChannelFactory::create_channel ( const CosNotification::QoSProperties & initial_qos, const CosNotification::AdminProperties & initial_admin, diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.h b/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.h index 1e07bca6ba5..d8fdfae268a 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.h +++ b/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.h @@ -20,6 +20,7 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "orbsvcs/CosNotifyChannelAdminS.h" +#include "orbsvcs/NotifyExtS.h" #include "Container_T.h" #include "Destroy_Callback.h" #include "Notify_Service.h" @@ -41,7 +42,7 @@ class TAO_NS_EventChannel; */ -class TAO_Notify_Export TAO_NS_EventChannelFactory : public virtual POA_CosNotifyChannelAdmin::EventChannelFactory, public TAO_NS_Container_T <TAO_NS_EventChannel, TAO_NS_EventChannelFactory, TAO_NS_Notify_Service>, public TAO_NS_Destroy_Callback +class TAO_Notify_Export TAO_NS_EventChannelFactory : public virtual POA_NotifyExt::EventChannelFactory, public TAO_NS_Container_T <TAO_NS_EventChannel, TAO_NS_EventChannelFactory, TAO_NS_Notify_Service>, public TAO_NS_Destroy_Callback { friend class TAO_NS_Builder; @@ -86,6 +87,12 @@ public: /// The default filter factory. CosNotifyFilter::FilterFactory_var default_filter_factory_; + /// = NotifyExt method + virtual void destroy (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + /// = CosNotifyChannelAdmin Methods virtual ::CosNotifyChannelAdmin::EventChannel_ptr create_channel (const CosNotification::QoSProperties & initial_qos, diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventType.cpp b/TAO/orbsvcs/orbsvcs/Notify/EventType.cpp index 13d1e1f5168..9ac68b89aad 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventType.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/EventType.cpp @@ -123,8 +123,7 @@ TAO_NS_EventType::is_special (void) const } void -TAO_NS_EventType::dump (void) +TAO_NS_EventType::dump (void) const { ACE_DEBUG ((LM_DEBUG, "(%s,%s)", this->event_type_.domain_name.in (), this->event_type_.type_name.in ())); } - diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventType.h b/TAO/orbsvcs/orbsvcs/Notify/EventType.h index 231ec34effa..edeaca96cbc 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventType.h +++ b/TAO/orbsvcs/orbsvcs/Notify/EventType.h @@ -67,7 +67,7 @@ public: // Get the type underneath us. /// Helper to print contents. - void dump (void); + void dump (void) const; protected: /// Init this object. diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.cpp b/TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.cpp index 30be26405fc..ccd6389e10c 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.cpp @@ -209,7 +209,7 @@ TAO_NS_EventTypeSeq::intersection (const TAO_NS_EventTypeSeq& rhs, const TAO_NS_ } void -TAO_NS_EventTypeSeq::dump (void) +TAO_NS_EventTypeSeq::dump (void) const { TAO_NS_EventTypeSeq::CONST_ITERATOR iter (*this); diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.h b/TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.h index d5a473ed762..b695dc9ea10 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.h +++ b/TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.h @@ -63,7 +63,7 @@ public: void populate_no_special (CosNotification::EventTypeSeq& event_type) const; /// Print the contents. - void dump (void); + void dump (void) const; }; #if defined (__ACE_INLINE__) diff --git a/TAO/orbsvcs/orbsvcs/Notify/Object.cpp b/TAO/orbsvcs/orbsvcs/Notify/Object.cpp index 12eb3f6b684..bff1c6ab139 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Object.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Object.cpp @@ -51,7 +51,6 @@ TAO_NS_Object::deactivate (ACE_ENV_SINGLE_ARG_DECL) void TAO_NS_Object::shutdown (ACE_ENV_SINGLE_ARG_DECL) { - this->shutdown_ = 1; this->deactivate (ACE_ENV_SINGLE_ARG_PARAMETER); this->shutdown_worker_task (); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Object_T.cpp b/TAO/orbsvcs/orbsvcs/Notify/Object_T.cpp index 54e3ba5ed57..9f0293ef589 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Object_T.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Object_T.cpp @@ -28,6 +28,15 @@ 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. + + this->shutdown_ = 1; + } + this->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; diff --git a/TAO/orbsvcs/orbsvcs/Notify/Object_T.h b/TAO/orbsvcs/orbsvcs/Notify/Object_T.h index a85d95531ff..77464132cc9 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Object_T.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Object_T.h @@ -46,6 +46,9 @@ protected: /// Parent PARENT* parent_; + + /// Are we shutdown (i,e. scheduled for destroy). + int shutdown_; }; #if defined (__ACE_INLINE__) diff --git a/TAO/orbsvcs/orbsvcs/Notify/Peer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Peer.cpp index 09d7d08787d..c3d84fdf1ed 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Peer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Peer.cpp @@ -46,12 +46,15 @@ TAO_NS_Peer::handle_dispatch_exception (ACE_ENV_SINGLE_ARG_DECL) void TAO_NS_Peer::dispatch_updates (const TAO_NS_EventTypeSeq & added, const TAO_NS_EventTypeSeq & removed ACE_ENV_ARG_DECL) { + TAO_NS_EventTypeSeq subscribed_types ; + this->proxy ()->subscribed_types (subscribed_types ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + ACE_TRY { CosNotification::EventTypeSeq cos_added; CosNotification::EventTypeSeq cos_removed; - const TAO_NS_EventTypeSeq& subscribed_types = this->proxy ()->subscribed_types (); const TAO_NS_EventType& special = TAO_NS_EventType::special (); // Don;t inform of types that we already know about. diff --git a/TAO/orbsvcs/orbsvcs/Notify/Properties.h b/TAO/orbsvcs/orbsvcs/Notify/Properties.h index 0f88b710689..4a0a6a03ffc 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Properties.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Properties.h @@ -19,7 +19,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ace/Singleton.h" +#include "tao/TAO_Singleton.h" #include "tao/ORB.h" #include "tao/PortableServer/PortableServer.h" #include "orbsvcs/CosNotificationC.h" @@ -35,7 +35,7 @@ class TAO_NS_Builder; */ class TAO_Notify_Export TAO_NS_Properties { - friend class ACE_Singleton<TAO_NS_Properties, TAO_SYNCH_MUTEX>; + friend class TAO_Singleton<TAO_NS_Properties, TAO_SYNCH_MUTEX>; public: /// Constuctor @@ -137,9 +137,9 @@ protected: CosNotification::QoSProperties pc_qos_; }; -typedef ACE_Singleton<TAO_NS_Properties, TAO_SYNCH_MUTEX> TAO_NS_PROPERTIES; +typedef TAO_Singleton<TAO_NS_Properties, TAO_SYNCH_MUTEX> TAO_NS_PROPERTIES; -TAO_NOTIFY_SINGLETON_DECLARE (ACE_Singleton, TAO_NS_Properties, TAO_SYNCH_MUTEX); +TAO_NOTIFY_SINGLETON_DECLARE (TAO_Singleton, TAO_NS_Properties, TAO_SYNCH_MUTEX); #if defined (__ACE_INLINE__) #include "Properties.inl" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Proxy.cpp b/TAO/orbsvcs/orbsvcs/Notify/Proxy.cpp index cf98d64de1a..906d4442389 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Proxy.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Proxy.cpp @@ -28,6 +28,17 @@ TAO_NS_Proxy::~TAO_NS_Proxy () } void +TAO_NS_Proxy::subscribed_types (TAO_NS_EventTypeSeq& subscribed_types ACE_ENV_ARG_DECL) +{ + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK; + + // copy + subscribed_types = this->subscribed_types_; +} + +void TAO_NS_Proxy::types_changed (const TAO_NS_EventTypeSeq& added, const TAO_NS_EventTypeSeq& removed ACE_ENV_ARG_DECL_NOT_USED) { TAO_NS_Method_Request_Updates request (added, removed, this); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Proxy.h b/TAO/orbsvcs/orbsvcs/Notify/Proxy.h index dafacfe494c..6fb58b71f10 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Proxy.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Proxy.h @@ -44,8 +44,8 @@ public: /// Destructor ~TAO_NS_Proxy (); - /// Subscribed types. - TAO_NS_EventTypeSeq& subscribed_types (void); + /// Obtain the Proxy's subscribed types. + void subscribed_types (TAO_NS_EventTypeSeq& subscribed_types ACE_ENV_ARG_DECL); /// Check if this event passes the admin and proxy filters. CORBA::Boolean check_filters (const TAO_NS_Event_var &event ACE_ENV_ARG_DECL); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Proxy.inl b/TAO/orbsvcs/orbsvcs/Notify/Proxy.inl index 16bb8abd7e2..3610f2b3167 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Proxy.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/Proxy.inl @@ -1,11 +1,5 @@ // $Id$ -ACE_INLINE TAO_NS_EventTypeSeq& -TAO_NS_Proxy::subscribed_types (void) -{ - return this->subscribed_types_; -} - ACE_INLINE CORBA::Boolean TAO_NS_Proxy::updates_off (void) { diff --git a/TAO/orbsvcs/orbsvcs/NotifyExt.idl b/TAO/orbsvcs/orbsvcs/NotifyExt.idl index 6a4692ad867..bfe41763349 100644 --- a/TAO/orbsvcs/orbsvcs/NotifyExt.idl +++ b/TAO/orbsvcs/orbsvcs/NotifyExt.idl @@ -11,6 +11,8 @@ #ifndef _NOTIFY_EXT_IDL_ #define _NOTIFY_EXT_IDL_ +#include "CosNotifyChannelAdmin.idl" + #pragma prefix "" /** @@ -65,6 +67,14 @@ module NotifyExt unsigned long max_buffered_requests; unsigned long max_request_buffer_size; }; + + /* + * Extend the EventChannelFactory to have a shutdown method. + */ + interface EventChannelFactory : CosNotifyChannelAdmin::EventChannelFactory + { + void destroy (); + }; }; #endif /* _NOTIFY_EXT_IDL_ */ |