diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2000-07-24 05:51:14 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2000-07-24 05:51:14 +0000 |
commit | 05b13531ba3a1296ff951a8c595efa259e890de9 (patch) | |
tree | 8b3403370cfe36a6ef17f63cbdb3e1a7242831ae | |
parent | ee263e5b66ad87abf32c67510da82e444fd61f1c (diff) | |
download | ATCD-05b13531ba3a1296ff951a8c595efa259e890de9.tar.gz |
ChangeLogTag:Mon Jul 24 01:27:53 2000 Ossama Othman <ossama@uci.edu>
-rw-r--r-- | TAO/ChangeLogs/ChangeLog-02a | 49 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connect.cpp | 14 | ||||
-rw-r--r-- | TAO/tao/Acceptor_Impl.cpp | 14 | ||||
-rw-r--r-- | TAO/tao/Acceptor_Registry.cpp | 5 | ||||
-rw-r--r-- | TAO/tao/Connector_Registry.cpp | 5 | ||||
-rw-r--r-- | TAO/tao/IIOP_Connect.cpp | 28 | ||||
-rw-r--r-- | TAO/tao/ORB_Core.cpp | 16 | ||||
-rw-r--r-- | TAO/tao/ORB_Core.h | 19 | ||||
-rw-r--r-- | TAO/tao/ORB_Core.i | 34 | ||||
-rw-r--r-- | TAO/tao/SHMIOP_Connect.cpp | 10 | ||||
-rw-r--r-- | TAO/tao/UIOP_Connect.cpp | 15 |
11 files changed, 196 insertions, 13 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index 1c35ea34772..a6c4bb2acfe 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,3 +1,49 @@ +Mon Jul 24 01:27:53 2000 Ossama Othman <ossama@uci.edu> + + * tao/Acceptor_Registry.cpp (open): + * tao/Connector_Registry.cpp (preconnect): + + Reclaim the memory used by the each endpoint set stored in + TAO_ORB_Parameters by reseting its contents. The endpoint set + is no longer needed once corresponding acceptors/connectors have + been initialized. + + * tao/ORB_Core.h (handle_set_): + * tao/ORB_Core.i (register_handle, remove_handle): + + New methods that are used when keeping track of open connections + when the "reactive" ORB concurrency model is used. The methods + simply add or remove a handle to the ORB Core's newly added open + connection handle set. + + * tao/ORB_Core.cpp (fini): + + Explicitly shutdown all open connections that have been + registered with the ORB Core by removing them from the Reactor + upon ORB destruction. This allows the ORB to use a Singleton + reactor, for example, instead of an ORB-specific one. + + * tao/Acceptor_Impl.cpp (activate_svc_handler): + + Keep track of open connections within the ORB Core so that they + can be explicitly removed from the reactor prior to shutting down + the ORB. This is particularly important for dynamically loaded + ORBs where an application level reactor, such as the Singleton + reactor, is used instead of an ORB created one. Register the + handle (not handler) associated with the connection that was just + accepted with the ORB Core. This form of open connection + tracking is only performed when the "reactive" ORB concurrency + model is selected. + + * tao/IIOP_Connect.cpp (handle_close): + * tao/SHMIOP_Connect.cpp (handle_close): + * tao/UIOP_Connect.cpp (handle_close): + * orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connect.cpp (handle_close): + + Deregister the handle corresponding to the Connection Handler + being shutdown from the ORB Core so that the ORB Core doesn't + attempt to remove it from the Reactor upon ORB destruction. + Sun Jul 23 22:01:23 2000 Irfan Pyarali <irfan@cs.wustl.edu> * tao: Fixed the following project/make files that still @@ -15,9 +61,8 @@ Sun Jul 23 18:18:35 2000 Yamuna Krishnamurthy <yamuna@cs.wustl.edu> * orbsvcs/tests/AVStreams/Multicast_Full_Profile/ftp.cpp: * orbsvcs/tests/AVStreams/Full_Profile/ftp.cpp: * orbsvcs/tests/AVStreams/Multicast/ftp.cpp: - + Fixed Compile Warnings - Sat Jul 22 17:36:58 2000 Jeff Parsons <parsons@cs.wustl.edu> diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connect.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connect.cpp index e59fea4468b..a5aac6b5faf 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connect.cpp +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connect.cpp @@ -13,6 +13,7 @@ #include "tao/Messaging_Policy_i.h" #include "tao/GIOP_Message_Lite.h" #include "tao/GIOP_Message_Acceptors.h" +#include "tao/Server_Strategy_Factory.h" #if !defined (__ACE_INLINE__) # include "SSLIOP_Connect.i" @@ -212,7 +213,18 @@ TAO_SSLIOP_Server_Connection_Handler::handle_close (ACE_HANDLE handle, --this->refcount_; if (this->refcount_ == 0) - return TAO_SSL_SVC_HANDLER::handle_close (handle, rm); + { + // Remove the handle from the ORB Core's handle set so that it + // isn't included in the set that is passed to the reactor upon + // ORB destruction. + TAO_Server_Strategy_Factory *f = + this->orb_core_->server_factory (); + + if (f->activate_server_connections () == 0) + (void) this->orb_core_->remove_handle (handle); + + return TAO_SSL_SVC_HANDLER::handle_close (handle, rm); + } return 0; } diff --git a/TAO/tao/Acceptor_Impl.cpp b/TAO/tao/Acceptor_Impl.cpp index be3f177f38f..b29f2481308 100644 --- a/TAO/tao/Acceptor_Impl.cpp +++ b/TAO/tao/Acceptor_Impl.cpp @@ -77,10 +77,24 @@ TAO_Concurrency_Strategy<SVC_HANDLER>::activate_svc_handler (SVC_HANDLER *sh, TAO_Server_Strategy_Factory *f = this->orb_core_->server_factory (); + // thread-per-connection concurrency model + if (f->activate_server_connections ()) return sh->activate (f->server_connection_thread_flags (), f->server_connection_thread_count ()); + // reactive concurrency model + + // Keep track of open connections so that they can be explicitly + // removed from the reactor prior to shutting down the ORB. This is + // particularly important for dynamically loaded ORBs where an + // application level reactor, such as the Singleton reactor, is used + // instead of an ORB created one. Register the handle (not handler) + // associated with the connection that was just accepted with the + // ORB Core. + if (this->orb_core_->register_handle (sh->get_handle ()) != 0) + return -1; + return this->orb_core_->reactor ()->register_handler (sh, ACE_Event_Handler::READ_MASK); } diff --git a/TAO/tao/Acceptor_Registry.cpp b/TAO/tao/Acceptor_Registry.cpp index 08ec327b1f1..2b5cdb38005 100644 --- a/TAO/tao/Acceptor_Registry.cpp +++ b/TAO/tao/Acceptor_Registry.cpp @@ -228,6 +228,11 @@ TAO_Acceptor_Registry::open (TAO_ORB_Core *orb_core, } } + // No longer need the endpoint set since all associated acceptors + // have been opened by now. Reclaim the memory used by the endpoint + // set. + endpoint_set.reset (); + return 0; } diff --git a/TAO/tao/Connector_Registry.cpp b/TAO/tao/Connector_Registry.cpp index 1a89726d964..c3ae5f7c7de 100644 --- a/TAO/tao/Connector_Registry.cpp +++ b/TAO/tao/Connector_Registry.cpp @@ -146,6 +146,11 @@ TAO_Connector_Registry::preconnect (TAO_ORB_Core *orb_core, (*connector)->preconnect (i->c_str ()); } + // No longer need the preconnect set since all associated + // preconnections have been opened by now. Reclaim the memory used + // by the preconnect set. + preconnections.reset (); + return 0; // Success } diff --git a/TAO/tao/IIOP_Connect.cpp b/TAO/tao/IIOP_Connect.cpp index 93356ae0be4..6477b4fffd3 100644 --- a/TAO/tao/IIOP_Connect.cpp +++ b/TAO/tao/IIOP_Connect.cpp @@ -9,7 +9,7 @@ #include "tao/Messaging_Policy_i.h" #include "tao/GIOP_Message_Lite.h" #include "tao/GIOP_Message_Acceptors.h" - +#include "tao/Server_Strategy_Factory.h" #if !defined (__ACE_INLINE__) # include "tao/IIOP_Connect.i" @@ -153,14 +153,18 @@ TAO_IIOP_Server_Connection_Handler::open (void*) // completely connected. ACE_INET_Addr addr; + char client[MAXHOSTNAMELEN + 16]; + + // Get the peername. if (this->peer ().get_remote_addr (addr) == -1) return -1; + // Verify that we can resolve the peer hostname. + else if (addr.addr_to_string (client, sizeof (client)) == -1) + return -1; + if (TAO_debug_level > 0) { - char client[MAXHOSTNAMELEN + 16]; - (void) addr.addr_to_string (client, sizeof (client)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) IIOP connection from client") ACE_TEXT ("<%s> on %d\n"), @@ -208,14 +212,26 @@ TAO_IIOP_Server_Connection_Handler::handle_close (ACE_HANDLE handle, { if (TAO_orbdebug) ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) IIOP_Server_Connection_Handler::handle_close ") + ACE_TEXT ("TAO (%P|%t) ") + ACE_TEXT ("IIOP_Server_Connection_Handler::handle_close ") ACE_TEXT ("(%d, %d)\n"), handle, rm)); --this->refcount_; if (this->refcount_ == 0) - return TAO_SVC_HANDLER::handle_close (handle, rm); + { + // Remove the handle from the ORB Core's handle set so that it + // isn't included in the set that is passed to the reactor upon + // ORB destruction. + TAO_Server_Strategy_Factory *f = + this->orb_core_->server_factory (); + + if (f->activate_server_connections () == 0) + (void) this->orb_core_->remove_handle (handle); + + return TAO_SVC_HANDLER::handle_close (handle, rm); + } return 0; } diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index ee0b11e5e0f..c616a7cf593 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -121,7 +121,8 @@ TAO_ORB_Core::TAO_ORB_Core (const char *orbid) transport_sync_strategy_ (0), svc_config_argc_ (0), svc_config_argv_ (0), - refcount_ (1) + refcount_ (1), + handle_set_ () { ACE_NEW (this->poa_current_, TAO_POA_Current); @@ -1280,6 +1281,19 @@ TAO_ORB_Core::fini (void) delete this->acceptor_registry_; } + // Shutdown all open connections that are registered with the ORB + // Core. Note that the ACE_Event_Handler::DONT_CALL mask is NOT + // used here since the reactor should invoke each handle's + // corresponding ACE_Event_Handler::handle_close() method to ensure + // that the connection is shutdown gracefully. + + // @@ Will the Server_Strategy_Factory still be around by the time + // this method is invoked? Specifically, is it possible that + // the Server_Strategy_Factory will already have been unloaded? + if (this->server_factory ()->activate_server_connections () == 0) + (void) this->reactor ()->remove_handler (this->handle_set_, + ACE_Event_Handler::ALL_EVENTS_MASK); + TAO_Internal::close_services (); // @@ This is not needed since the default resource factory diff --git a/TAO/tao/ORB_Core.h b/TAO/tao/ORB_Core.h index 920bb93c685..caf1b416a20 100644 --- a/TAO/tao/ORB_Core.h +++ b/TAO/tao/ORB_Core.h @@ -482,6 +482,16 @@ public: CORBA::ULong _decr_refcnt (void); // Reference counting... + int register_handle (ACE_HANDLE handle); + // Register the handle of an open connection with the ORB Core + // handle set. This handle set will be used to explicitly remove + // corresponding event handlers from the reactor. + + int remove_handle (ACE_HANDLE handle); + // Remove <handle> from the ORB Core's handle set so that it + // isn't included in the set that is passed to the reactor upon ORB + // destruction. + protected: int init (int &argc, char **argv, CORBA::Environment &ACE_TRY_ENV); @@ -526,7 +536,7 @@ protected: // = Data members. TAO_Connector_Registry *connector_registry_; - // The connector registry which all active connecters must register + // The connector registry which all active connectors must register // themselves with. TAO_Acceptor_Registry *acceptor_registry_; @@ -700,6 +710,13 @@ protected: CORBA::ULong refcount_; // Number of outstanding references to this object. + + ACE_Handle_Set handle_set_; + // Set of file descriptors corresponding to open connections. This + // handle set is used to explicitly deregister the connection event + // handlers from the Reactor. This is particularly important for + // dynamically loaded ORBs where an application level reactor, such + // as the Singleton reactor, is used instead of an ORB created one. }; // **************************************************************** diff --git a/TAO/tao/ORB_Core.i b/TAO/tao/ORB_Core.i index f80f8a9694f..317c02a6049 100644 --- a/TAO/tao/ORB_Core.i +++ b/TAO/tao/ORB_Core.i @@ -25,6 +25,40 @@ TAO_ORB_Core::_decr_refcnt (void) return 0; } +ACE_INLINE int +TAO_ORB_Core::register_handle (ACE_HANDLE handle) +{ + if (handle == ACE_INVALID_HANDLE) + { + errno = EINVAL; + return -1; + } + + // Acquire a lock to ensure that modifications to the state within + // the handle set are atomic. + ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->lock_, -1)); + this->handle_set_.set_bit (handle); + + return 0; +} + +ACE_INLINE int +TAO_ORB_Core::remove_handle (ACE_HANDLE handle) +{ + if (handle == ACE_INVALID_HANDLE) + { + errno = EINVAL; + return -1; + } + + // Acquire a lock to ensure that modifications to the state within + // the handle set are atomic. + ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->lock_, -1)); + this->handle_set_.clr_bit (handle); + + return 0; +} + ACE_INLINE ACE_Thread_Manager * TAO_ORB_Core::thr_mgr (void) { diff --git a/TAO/tao/SHMIOP_Connect.cpp b/TAO/tao/SHMIOP_Connect.cpp index 886c9dafb2f..2544f92e312 100644 --- a/TAO/tao/SHMIOP_Connect.cpp +++ b/TAO/tao/SHMIOP_Connect.cpp @@ -12,6 +12,7 @@ #include "tao/Messaging_Policy_i.h" #include "tao/GIOP_Message_Acceptors.h" #include "tao/GIOP_Message_Lite.h" +#include "tao/Server_Strategy_Factory.h" #if !defined (__ACE_INLINE__) # include "tao/SHMIOP_Connect.i" @@ -217,6 +218,15 @@ TAO_SHMIOP_Server_Connection_Handler::handle_close (ACE_HANDLE handle, --this->refcount_; if (this->refcount_ == 0) { + // Remove the handle from the ORB Core's handle set so that it + // isn't included in the set that is passed to the reactor upon + // ORB destruction. + TAO_Server_Strategy_Factory *f = + this->orb_core_->server_factory (); + + if (f->activate_server_connections () == 0) + (void) this->orb_core_->remove_handle (handle); + this->peer().remove (); return TAO_SHMIOP_SVC_HANDLER::handle_close (handle, rm); } diff --git a/TAO/tao/UIOP_Connect.cpp b/TAO/tao/UIOP_Connect.cpp index 1a1a05d8912..68f2b4ac238 100644 --- a/TAO/tao/UIOP_Connect.cpp +++ b/TAO/tao/UIOP_Connect.cpp @@ -11,7 +11,7 @@ #include "tao/ORB.h" #include "tao/CDR.h" #include "tao/Timeprobe.h" - +#include "tao/Server_Strategy_Factory.h" #include "tao/Messaging_Policy_i.h" #if !defined (__ACE_INLINE__) @@ -204,7 +204,18 @@ TAO_UIOP_Server_Connection_Handler::handle_close (ACE_HANDLE handle, --this->refcount_; if (this->refcount_ == 0) - return TAO_UIOP_SVC_HANDLER::handle_close (handle, rm); + { + // Remove the handle from the ORB Core's handle set so that it + // isn't included in the set that is passed to the reactor upon + // ORB destruction. + TAO_Server_Strategy_Factory *f = + this->orb_core_->server_factory (); + + if (f->activate_server_connections () == 0) + (void) this->orb_core_->remove_handle (handle); + + return TAO_UIOP_SVC_HANDLER::handle_close (handle, rm); + } return 0; } |