diff options
author | bala <balanatarajan@users.noreply.github.com> | 2000-11-06 20:32:01 +0000 |
---|---|---|
committer | bala <balanatarajan@users.noreply.github.com> | 2000-11-06 20:32:01 +0000 |
commit | acf9e5be1e9cc0f9f63369d7777494e097e8f6e9 (patch) | |
tree | 3fc7f550ce21dc2f750f21f454c33d8205722cd9 /TAO/tao/Acceptor_Impl.cpp | |
parent | 06d9f61549927e1b611ce6918aeca304986d926d (diff) | |
download | ATCD-acf9e5be1e9cc0f9f63369d7777494e097e8f6e9.tar.gz |
ChangeLogTag: Mon Nov 6 13:54:20 2000 Balachandran Natarajan <bala@cs.wustl.edu>
Diffstat (limited to 'TAO/tao/Acceptor_Impl.cpp')
-rw-r--r-- | TAO/tao/Acceptor_Impl.cpp | 92 |
1 files changed, 15 insertions, 77 deletions
diff --git a/TAO/tao/Acceptor_Impl.cpp b/TAO/tao/Acceptor_Impl.cpp index 9a1e6d773dd..6c830b19fc2 100644 --- a/TAO/tao/Acceptor_Impl.cpp +++ b/TAO/tao/Acceptor_Impl.cpp @@ -89,15 +89,18 @@ TAO_Concurrency_Strategy<SVC_HANDLER>::activate_svc_handler (SVC_HANDLER *sh, // 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; + // Bump the reference count. This helps keeping track of the number + // of places the handler is registered with. This is particularly + // helpful when it is needed to explicitly remove them 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. + sh->incr_ref_count (); + + // Also set the flag in the connection handler to indicate whether + // the handler has been registered with the reactor + sh->is_registered (1); return this->orb_core_->reactor ()->register_handler (sh, ACE_Event_Handler::READ_MASK); @@ -116,81 +119,16 @@ TAO_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::open (const ACE_PEER_ACCE int restart) { - int result = ACCEPT_STRATEGY_BASE::open (local_addr, - restart); - -#if !defined (TAO_USES_ROBUST_CONNECTION_MGMT) - - return result; - -#else /* ! TAO_USES_ROBUST_CONNECTION_MGMT */ - if (result == 0) - return result; - - // If the error occured due to the fact that the open handle limit - // was exhausted, then purge some "old" connections. - result = this->out_of_sockets_handler (); - if (result == -1) - return -1; - - // If we are able to purge, try again. - return ACCEPT_STRATEGY_BASE::open (local_addr, restart); -#endif /* !TAO_USES_ROBUST_CONNECTION_MGMT */ + return ACCEPT_STRATEGY_BASE::open (local_addr, + restart); } template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int TAO_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::accept_svc_handler (SVC_HANDLER *svc_handler) { - int result = ACCEPT_STRATEGY_BASE::accept_svc_handler (svc_handler); - -#if defined (TAO_USES_ROBUST_CONNECTION_MGMT) - if (result == 0) - return result; - - // If the error occured due to the fact that the open handle limit - // was exhausted, then purge some "old" connections. - this->out_of_sockets_handler (); -#endif /* TAO_USES_ROBUST_CONNECTION_MGMT */ - - return result; + return ACCEPT_STRATEGY_BASE::accept_svc_handler (svc_handler); } -#if defined (TAO_USES_ROBUST_CONNECTION_MGMT) -template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int -TAO_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::out_of_sockets_handler (void) -{ - if (ACE::out_of_handles (errno)) - { - // Close some cached connections by explicitly purging the - // connection cache maintained by the connectors in the - // connector registry. - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - "Purging connections from Connectors in Connector Registry of all ORBs...\n")); - - ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, guard, - *ACE_Static_Object_Lock::instance (), 0)); - - TAO_ORB_Table *table = TAO_ORB_Table::instance (); - TAO_ORB_Table::Iterator end = table->end (); - for (TAO_ORB_Table::Iterator iterator = table->begin (); - iterator != end; - ++iterator) - { - TAO_ORB_Core *orb_core = (*iterator).int_id_; - - int result = orb_core->connector_registry ()->purge_connections (); - - if (result != 0) - return result; - } - - return 0; - } - - return -1; -} -#endif /* TAO_USES_ROBUST_CONNECTION_MGMT */ ///////////////////////////////////////////////////////////////////// |