diff options
Diffstat (limited to 'TAO/tao/ORB_Core.cpp')
-rw-r--r-- | TAO/tao/ORB_Core.cpp | 633 |
1 files changed, 133 insertions, 500 deletions
diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index c3f9eee9a41..27c233dfa41 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -11,9 +11,7 @@ #include "debug.h" #include "MProfile.h" #include "Stub.h" -#include "Reactor_Registry.h" #include "Leader_Follower.h" -#include "Transport_Cache_Manager.h" #include "Connector_Registry.h" #include "Acceptor_Registry.h" @@ -27,16 +25,15 @@ #include "Invocation.h" #include "BiDir_Adapter.h" -#include "Default_Stub_Factory.h" -#include "Default_Endpoint_Selector_Factory.h" -#include "Default_Protocols_Hooks.h" +#include "tao/Thread_Lane_Resources.h" +#include "tao/Thread_Lane_Resources_Manager.h" +#include "tao/Collocation_Resolver.h" +#include "tao/Stub_Factory.h" #include "IORInfo.h" #include "Flushing_Strategy.h" -#include "POA_Extension_Initializer.h" - #if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1) # include "Buffering_Constraint_Policy.h" #endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */ @@ -73,6 +70,10 @@ TAO_ORB_Core::Sync_Scope_Hook TAO_ORB_Core::sync_scope_hook_ = 0; const char * TAO_ORB_Core::endpoint_selector_factory_name_ = "Default_Endpoint_Selector_Factory"; +const char * TAO_ORB_Core::thread_lane_resources_manager_factory_name_ = + "Default_Thread_Lane_Resources_Manager_Factory"; +const char * TAO_ORB_Core::collocation_resolver_name_ = + "Default_Collocation_Resolver"; const char * TAO_ORB_Core::stub_factory_name_ = "Default_Stub_Factory"; const char * TAO_ORB_Core::resource_factory_name_ = @@ -91,11 +92,11 @@ const char * TAO_ORB_Core::poa_factory_directive_ = "dynamic TAO_POA Service_Object * TAO_PortableServer:_make_TAO_Object_Adapter_Factory()"; TAO_ORB_Core::TAO_ORB_Core (const char *orbid) - : poa_extension_initializer_ (0), - protocols_hooks_ (0), + : protocols_hooks_ (0), lock_ (), connector_registry_ (0), - acceptor_registry_ (0), + thread_lane_resources_manager_ (0), + collocation_resolver_ (0), stub_factory_ (0), protocol_factories_ (0), implrepo_service_ (CORBA::Object::_nil ()), @@ -114,17 +115,8 @@ TAO_ORB_Core::TAO_ORB_Core (const char *orbid) message_block_dblock_allocator_ (0), message_block_buffer_allocator_ (0), message_block_msgblock_allocator_ (0), - resource_factory_from_service_config_ (0), - // @@ This is not needed since the default resource factory, fredk - // is statically added to the service configurator. client_factory_ (0), - client_factory_from_service_config_ (0), - // @@ This is not needed since the default client factory, fredk - // is statically added to the service configurator. server_factory_ (0), - server_factory_from_service_config_ (0), - // @@ This is not needed since the default server factory, fredk - // is statically added to the service configurator. opt_for_collocation_ (1), use_global_collocation_ (1), collocation_strategy_ (THRU_POA), @@ -149,12 +141,8 @@ TAO_ORB_Core::TAO_ORB_Core (const char *orbid) use_tss_resources_ (0), tss_resources_ (), orb_resources_ (), - reactor_registry_ (0), - reactor_ (0), has_shutdown_ (1), thread_per_connection_use_timeout_ (1), - open_lock_ (), - open_called_ (0), endpoint_selector_factory_ (0), // Start the ORB in a "shutdown" state. Only after // CORBA::ORB_init() is called will the ORB no longer be shutdown. @@ -173,11 +161,9 @@ TAO_ORB_Core::TAO_ORB_Core (const char *orbid) #endif /* TAO_HAS_INTERCEPTORS == 1 */ ior_interceptors_ (), parser_registry_ (), - transport_cache_ (0), bidir_adapter_ (0), bidir_giop_policy_ (0), - flushing_strategy_ (0), - corba_priority_normalizer_ (0) + flushing_strategy_ (0) { #if defined(ACE_MVS) ACE_NEW (this->from_iso8859_, ACE_IBM1047_ISO8859); @@ -209,15 +195,13 @@ TAO_ORB_Core::TAO_ORB_Core (const char *orbid) ACE_NEW (this->transport_sync_strategy_, TAO_Transport_Sync_Strategy); - - ACE_NEW (this->corba_priority_normalizer_, - TAO_CORBA_Priority_Normalizer); } TAO_ORB_Core::~TAO_ORB_Core (void) { + delete this->thread_lane_resources_manager_; + delete this->flushing_strategy_; - delete this->transport_cache_; ACE_OS::free (this->orbid_); @@ -240,10 +224,6 @@ TAO_ORB_Core::~TAO_ORB_Core (void) #endif /* TAO_HAS_CORBA_MESSAGING == 1 */ delete this->transport_sync_strategy_; - - delete this->poa_extension_initializer_; - - delete this->corba_priority_normalizer_; } #if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1) @@ -909,10 +889,6 @@ TAO_ORB_Core::init (int &argc, char *argv[], CORBA::Environment &ACE_TRY_ENV) else this->use_tss_resources_ = use_tss_resources; - this->reactor_registry_ = - trf->get_reactor_registry (); - this->reactor_registry_->open (this); - // @@ ???? // Make sure the reactor is initialized... ACE_Reactor *reactor = this->reactor (); @@ -1030,11 +1006,6 @@ TAO_ORB_Core::init (int &argc, char *argv[], CORBA::Environment &ACE_TRY_ENV) // Initialize the flushing strategy this->flushing_strategy_ = trf->create_flushing_strategy (); - // Create the purging strategy - ACE_NEW_RETURN(this->transport_cache_, - TAO_Transport_Cache_Manager(trf), - -1); - // Now that we have a complete list of available protocols and their // related factory objects, set default policies and initialize the // registries! @@ -1054,19 +1025,6 @@ TAO_ORB_Core::init (int &argc, char *argv[], CORBA::Environment &ACE_TRY_ENV) CORBA::COMPLETED_NO), -1); - // Open the Transport Cache - // @@ This seems to be a nice place to configure the transport - // cache for the number of allowed entries - if (this->transport_cache_->open (this) == -1) - { - ACE_THROW_RETURN (CORBA::INITIALIZE ( - CORBA::SystemException::_tao_minor_code ( - TAO_ORB_CORE_INIT_LOCATION_CODE, - 0), - CORBA::COMPLETED_NO), - -1); - } - // Initialize the connector registry and create a connector for each // configured protocol. if (this->connector_registry ()->open (this) != 0) @@ -1083,7 +1041,6 @@ TAO_ORB_Core::init (int &argc, char *argv[], CORBA::Environment &ACE_TRY_ENV) this, this->orb_params ()->preconnects ()); - // Look for BiDirectional library here. If the user has svc.conf // file, load the library at this point. int ret = this->bidirectional_giop_init (ACE_TRY_ENV); @@ -1153,56 +1110,11 @@ TAO_ORB_Core::fini (void) delete this->connector_registry_; } - // Ask the registry to close all registered acceptors. - if (this->acceptor_registry_ != 0) - { - this->acceptor_registry_->close_all (); - delete this->acceptor_registry_; - } - - // 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. - - ACE_Handle_Set handle_set; - TAO_EventHandlerSet unregistered; - - // Close the transport cache and return the handle set that needs - // to be de-registered from the reactor. - if (this->transport_cache_ != 0) - { - this->transport_cache_->close (handle_set, unregistered); - } - - // 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 prior to destroying - // the ORB Core. - if (handle_set.num_set () > 0) - (void) this->reactor ()->remove_handler (handle_set, - ACE_Event_Handler::ALL_EVENTS_MASK); - if (!unregistered.is_empty ()) - { - ACE_Event_Handler** eh; - for (TAO_EventHandlerSetIterator iter(unregistered); - iter.next (eh); iter.advance()) - { - (*eh)->handle_close (ACE_INVALID_HANDLE, - ACE_Event_Handler::ALL_EVENTS_MASK); - } - } - // Pass reactor back to the resource factory. - if (this->resource_factory_ != 0) - this->resource_factory_->reclaim_reactor (this->reactor_); + // Finalize lane resources. + this->thread_lane_resources_manager ().finalize (); (void) TAO_Internal::close_services (); - delete this->reactor_registry_; - if (this->message_block_dblock_allocator_) this->message_block_dblock_allocator_->remove (); delete this->message_block_dblock_allocator_; @@ -1215,58 +1127,31 @@ TAO_ORB_Core::fini (void) this->message_block_msgblock_allocator_->remove (); delete this->message_block_msgblock_allocator_; - // @@ This is not needed since the default resource factory - // is statically added to the service configurator, fredk - if (!this->resource_factory_from_service_config_) - delete resource_factory_; - - // @@ This is not needed since the default client factory - // is statically added to the service configurator, fredk - if (!this->client_factory_from_service_config_) - delete client_factory_; - - // @@ This is not needed since the default server factory - // is statically added to the service configurator, fredk - if (!this->server_factory_from_service_config_) - delete server_factory_; - delete this; return 0; } -TAO_CORBA_Priority_Normalizer::~TAO_CORBA_Priority_Normalizer (void) -{ -} - -CORBA::Boolean -TAO_CORBA_Priority_Normalizer::normalize (CORBA::Short corba_priority, - CORBA::Short &normalized_corba_priority) -{ - normalized_corba_priority = corba_priority; - return 1; -} - -TAO_CORBA_Priority_Normalizer * -TAO_ORB_Core::corba_priority_normalizer (void) const +void +TAO_ORB_Core::set_thread_lane_resources_manager_factory (const char *thread_lane_resources_manager_factory_name) { - return this->corba_priority_normalizer_; + TAO_ORB_Core::thread_lane_resources_manager_factory_name_ = + thread_lane_resources_manager_factory_name; } void -TAO_ORB_Core::corba_priority_normalizer (TAO_CORBA_Priority_Normalizer *new_normalizer) +TAO_ORB_Core::set_collocation_resolver (const char *collocation_resolver_name) { - delete this->corba_priority_normalizer_; - this->corba_priority_normalizer_ = new_normalizer; + TAO_ORB_Core::collocation_resolver_name_ = + collocation_resolver_name; } void -TAO_ORB_Core::set_stub_factory(const char *stub_factory_name) +TAO_ORB_Core::set_stub_factory (const char *stub_factory_name) { TAO_ORB_Core::stub_factory_name_ = stub_factory_name; } - void TAO_ORB_Core::set_resource_factory (const char *resource_factory_name) { @@ -1312,47 +1197,51 @@ TAO_ORB_Core::typecodefactory_adapter_name (void) TAO_Resource_Factory * TAO_ORB_Core::resource_factory (void) { - if (this->resource_factory_ == 0) - { - // Look in the service repository for an instance. - this->resource_factory_ = - ACE_Dynamic_Service<TAO_Resource_Factory>::instance - (TAO_ORB_Core::resource_factory_name_); - // @@ Not needed! - this->resource_factory_from_service_config_ = 1; - } + // Check if there is a cached reference. + if (this->resource_factory_ != 0) + return this->resource_factory_; - //@@ None of this stuff is needed since the default resource factory - // is statically adde to the Service Configurator! - if (this->resource_factory_ == 0) - { - // Still don't have one, so let's allocate the default. This - // will throw an exception if it fails on exception-throwing - // platforms. - if (TAO_debug_level > 0) - ACE_ERROR ((LM_WARNING, - ACE_TEXT ("(%P|%t) WARNING - No Resource Factory found ") - ACE_TEXT ("in Service Repository.\n") - ACE_TEXT (" Using default instance with GLOBAL resource ") - ACE_TEXT ("source specifier.\n"))); - - TAO_Default_Resource_Factory *default_factory; - ACE_NEW_RETURN (default_factory, - TAO_Default_Resource_Factory, - 0); - - // @@ Not needed. - this->resource_factory_from_service_config_ = 0; - this->resource_factory_ = default_factory; - - // @@ At this point we need to register this with the - // Service_Repository in order to get it cleaned up properly. - // But, for now we let it leak. - } + // Look in the service repository for an instance. + this->resource_factory_ = + ACE_Dynamic_Service<TAO_Resource_Factory>::instance + (TAO_ORB_Core::resource_factory_name_); return this->resource_factory_; } +TAO_Thread_Lane_Resources_Manager & +TAO_ORB_Core::thread_lane_resources_manager (void) +{ + // Check if there is a cached reference. + if (this->thread_lane_resources_manager_ != 0) + return *this->thread_lane_resources_manager_; + + // If not, lookup the corresponding factory and ask it to make one. + TAO_Thread_Lane_Resources_Manager_Factory *factory = + ACE_Dynamic_Service<TAO_Thread_Lane_Resources_Manager_Factory>::instance + (TAO_ORB_Core::thread_lane_resources_manager_factory_name_); + + this->thread_lane_resources_manager_ = + factory->create_thread_lane_resources_manager (*this); + + return *this->thread_lane_resources_manager_; +} + +TAO_Collocation_Resolver & +TAO_ORB_Core::collocation_resolver (void) +{ + // Check if there is a cached reference. + if (this->collocation_resolver_ != 0) + return *this->collocation_resolver_; + + // If not, lookup it up. + this->collocation_resolver_ = + ACE_Dynamic_Service<TAO_Collocation_Resolver>::instance + (TAO_ORB_Core::collocation_resolver_name_); + + return *this->collocation_resolver_; +} + TAO_Stub_Factory * TAO_ORB_Core::stub_factory (void) { @@ -1365,38 +1254,12 @@ TAO_ORB_Core::stub_factory (void) ACE_Dynamic_Service<TAO_Stub_Factory>::instance (TAO_ORB_Core::stub_factory_name_); - // If there still isn't a reference, allocate the default. - if (this->stub_factory_ == 0) - { - if (TAO_debug_level > 0) - ACE_ERROR ((LM_WARNING, - ACE_TEXT ("(%P|%t) WARNING - No Stub Factory found ") - ACE_TEXT ("in Service Repository.\n") - ACE_TEXT (" Using default instance with GLOBAL resource ") - ACE_TEXT ("source specifier.\n"))); - - // @@ RTCORBA Subsetting: The following comment probably should say - // this if this doesn't work, a segmentation fault will be quickly - // generated... - - // This will throw an exception if it fails on exception-throwing - // platforms. - TAO_Stub_Factory *stub_factory; - ACE_NEW_RETURN (stub_factory, - TAO_Default_Stub_Factory, - 0); - - // Store a copy for later use. - this->stub_factory_ = stub_factory; - } - return this->stub_factory_; } void -TAO_ORB_Core::set_poa_factory ( - const char *poa_factory_name, - const char *poa_factory_directive) +TAO_ORB_Core::set_poa_factory (const char *poa_factory_name, + const char *poa_factory_directive) { TAO_ORB_Core::poa_factory_name_ = poa_factory_name; TAO_ORB_Core::poa_factory_directive_ = poa_factory_directive; @@ -1404,8 +1267,7 @@ TAO_ORB_Core::set_poa_factory ( void -TAO_ORB_Core::set_endpoint_selector_factory ( - const char *endpoint_selector_factory_name) +TAO_ORB_Core::set_endpoint_selector_factory (const char *endpoint_selector_factory_name) { TAO_ORB_Core::endpoint_selector_factory_name_ = endpoint_selector_factory_name; @@ -1423,31 +1285,6 @@ TAO_ORB_Core::endpoint_selector_factory (void) ACE_Dynamic_Service<TAO_Endpoint_Selector_Factory>::instance (TAO_ORB_Core::endpoint_selector_factory_name_); - // If there still isn't a reference, allocate the default. - if (this->endpoint_selector_factory_ == 0) - { - if (TAO_debug_level > 0) - ACE_ERROR ((LM_WARNING, - ACE_TEXT ("(%P|%t) WARNING - No Endpoint Selector Factory found ") - ACE_TEXT ("in Service Repository.\n") - ACE_TEXT (" Using default instance with GLOBAL resource ") - ACE_TEXT ("source specifier.\n"))); - - // @@ RTCORBA Subsetting: The following comment probably should say - // this if this doesn't work, a segmentation fault will be quickly - // generated... - - // This will throw an exception if it fails on exception-throwing - // platforms. - TAO_Endpoint_Selector_Factory *selector_factory; - ACE_NEW_RETURN (selector_factory, - TAO_Default_Endpoint_Selector_Factory, - 0); - - // Store a copy for later use. - this->endpoint_selector_factory_ = selector_factory; - } - return this->endpoint_selector_factory_; } @@ -1469,28 +1306,6 @@ TAO_ORB_Core::get_protocols_hooks (CORBA::Environment &ACE_TRY_ENV) ACE_Dynamic_Service<TAO_Protocols_Hooks>::instance (TAO_ORB_Core::protocols_hooks_name_); - //@@ None of this stuff is needed since the default client factory - // is statically added to the Service Configurator, fredk - // If there still isn't a reference, allocate the default. - if (this->protocols_hooks_ == 0) - { - if (TAO_debug_level > 0) - ACE_ERROR ((LM_WARNING, - ACE_TEXT ("(%P|%t) WARNING - No Protocols Hooks found ") - ACE_TEXT ("in Service Repository.\n") - ACE_TEXT (" Using default instance with GLOBAL resource ") - ACE_TEXT ("source specifier.\n"))); - - TAO_Protocols_Hooks *protocols_hooks; - ACE_NEW_THROW_EX (protocols_hooks, - TAO_Default_Protocols_Hooks, - CORBA::NO_MEMORY ()); - ACE_CHECK_RETURN (0); - - // Store a copy for later use. - this->protocols_hooks_ = protocols_hooks; - } - // Initialize the protocols hooks instance. this->protocols_hooks_->init_hooks (this, ACE_TRY_ENV); @@ -1504,14 +1319,14 @@ TAO_ORB_Core::bidirectional_giop_init (CORBA::Environment &ACE_TRY_ENV) if (this->bidir_adapter_ == 0) { this->bidir_adapter_ = - ACE_Dynamic_Service<TAO_BiDir_Adapter>::instance ("BiDirGIOP_Loader"); + ACE_Dynamic_Service<TAO_BiDir_Adapter>::instance ("BiDirGIOP_Loader"); } if (this->bidir_adapter_) - return this->bidir_adapter_->activate (this->orb_.in (), - 0, - 0, - ACE_TRY_ENV); + return this->bidir_adapter_->activate (this->orb_.in (), + 0, + 0, + ACE_TRY_ENV); else return 0; } @@ -1622,34 +1437,9 @@ TAO_ORB_Core::client_factory (void) { // Look in the service repository for an instance. this->client_factory_ = - ACE_Dynamic_Service<TAO_Client_Strategy_Factory>::instance ( - "Client_Strategy_Factory"); - // @@ Not needed! - this->client_factory_from_service_config_ = 1; + ACE_Dynamic_Service<TAO_Client_Strategy_Factory>::instance ("Client_Strategy_Factory"); } - //@@ None of this stuff is needed since the default client factory - // is statically added to the Service Configurator, fredk - if (this->client_factory_ == 0) - { - // Still don't have one, so let's allocate the default. This - // will throw an exception if it fails on exception-throwing - // platforms. - if (TAO_debug_level > 0) - ACE_ERROR ((LM_WARNING, - ACE_TEXT ("(%P|%t) WARNING - No Client Strategy Factory found ") - ACE_TEXT ("in Service Repository.\n") - ACE_TEXT (" Using default instance.\n"))); - - ACE_NEW_RETURN (this->client_factory_, - TAO_Default_Client_Strategy_Factory, - 0); - - this->client_factory_from_service_config_ = 0; - // At this point we need to register this with the - // Service_Repository in order to get it cleaned up properly. - // But, for now we let it leak. - } return this->client_factory_; } @@ -1660,35 +1450,7 @@ TAO_ORB_Core::server_factory (void) { // Look in the service repository for an instance. this->server_factory_ = - ACE_Dynamic_Service<TAO_Server_Strategy_Factory>::instance ( - "Server_Strategy_Factory"); - // @@ Not needed! - this->server_factory_from_service_config_ = 1; - } - - //@@ None of this stuff is needed since the default server factory - // is statically added to the Service Configurator, fredk - - // If the <server_factory_> isn't found it's usually because the ORB - // hasn't been intialized correctly... - if (this->server_factory_ == 0) - { - // Still don't have one, so let's allocate the default. - if (TAO_debug_level > 0) - ACE_ERROR ((LM_WARNING, - ACE_TEXT ("(%P|%t) WARNING - No %s found in Service Repository.") - ACE_TEXT (" Using default instance.\n"), - ACE_TEXT ("Server Strategy Factory"))); - - ACE_NEW_RETURN (this->server_factory_, - TAO_Default_Server_Strategy_Factory, - 0); - - // @@ Not needed! - this->server_factory_from_service_config_ = 0; - // At this point we need to register this with the - // <Service_Repository> to get it cleaned up properly. But, for - // now we let it leak. + ACE_Dynamic_Service<TAO_Server_Strategy_Factory>::instance ("Server_Strategy_Factory"); } return this->server_factory_; @@ -1709,30 +1471,6 @@ TAO_ORB_Core::inherit_from_parent_thread ( if (tss_resources == 0) return -1; -#if 0 - if (tss_resources->reactor_ != 0) - { - // We'll use the spawning thread's reactor. - TAO_ORB_Core_TSS_Resources *tss = this->get_tss_resources (); - if (tss->reactor_ != 0 && TAO_debug_level > 0) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) non nil reactor on thread startup!\n")); - - if (tss == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) %p\n", - "TAO_ORB_Core::inherit_from_parent_thread" - " (); no more TSS keys"), - -1); - - if (/* tss->owns_resources_ != 0 && */ !tss->inherited_reactor_) - delete tss->reactor_; - } - tss->reactor_ = tss_resources->reactor_; - tss->inherited_reactor_ = 1; - } -#endif /* 0 */ return 0; } @@ -1788,15 +1526,14 @@ TAO_ORB_Core::poa_adapter (void) } TAO_Stub * -TAO_ORB_Core::create_stub(const char *repository_id, - const TAO_MProfile &profiles, - TAO_ORB_Core *orb_core, - CORBA::Environment &ACE_TRY_ENV) +TAO_ORB_Core::create_stub (const char *repository_id, + const TAO_MProfile &profiles, + CORBA::Environment &ACE_TRY_ENV) { TAO_Stub *retval = this->stub_factory ()->create_stub (repository_id, profiles, - orb_core, + this, ACE_TRY_ENV); ACE_CHECK_RETURN(0); return retval; @@ -1804,60 +1541,27 @@ TAO_ORB_Core::create_stub(const char *repository_id, TAO_Stub * -TAO_ORB_Core::create_stub_object (const TAO_ObjectKey &key, +TAO_ORB_Core::create_stub_object (TAO_MProfile &mprofile, const char *type_id, CORBA::PolicyList *policy_list, - TAO_Acceptor_Filter *filter, CORBA::Environment &ACE_TRY_ENV) { - (void) this->open (ACE_TRY_ENV); - ACE_CHECK_RETURN (0); - - TAO_Stub *stub = 0; - - // Create a profile container and have Acceptor_Registry populate it - // with profiles as appropriate. - TAO_MProfile mp (0); - if (this->acceptor_registry ()->make_mprofile (key, mp, filter) == -1) - { - ACE_THROW_RETURN (CORBA::INTERNAL ( - CORBA::SystemException::_tao_minor_code ( - TAO_MPROFILE_CREATION_ERROR, - 0), - CORBA::COMPLETED_NO), - 0); - } - - // Make sure we have at least one profile. <mp> may end up being - // empty if none of the acceptor endpoints have the right priority - // for this object, for example. - if (mp.profile_count () == 0) - { - ACE_THROW_RETURN (CORBA::BAD_PARAM ( - CORBA::SystemException::_tao_minor_code ( - TAO_MPROFILE_CREATION_ERROR, - 0 ), - CORBA::COMPLETED_NO), - 0); - } - - // Add the Polices contained in "policy_list" to each profile - // so that those policies will be exposed to the client in the IOR. - // In particular each CORBA::Policy has to be converted in to - // Messaging::PolicyValue, and then all the Messaging::PolicyValue - // should be embedded inside a Messaging::PolicyValueSeq which became - // in turns the "body" of the IOP::TaggedComponent. This conversion - // is a responsability of the CORBA::Profile class. - // (See orbos\98-05-05.pdf Section 5.4) - + // Add the Polices contained in "policy_list" to each profile so + // that those policies will be exposed to the client in the IOR. In + // particular each CORBA::Policy has to be converted in to + // Messaging::PolicyValue, and then all the Messaging::PolicyValue + // should be embedded inside a Messaging::PolicyValueSeq which + // became in turns the "body" of the IOP::TaggedComponent. This + // conversion is a responsability of the CORBA::Profile class. (See + // orbos\98-05-05.pdf Section 5.4) if (policy_list->length () != 0) { TAO_Profile * profile; - for (CORBA::ULong i = 0; i < mp.profile_count (); ++i) + for (CORBA::ULong i = 0; i < mprofile.profile_count (); ++i) { // Get the ith profile - profile = mp.get_profile (i); + profile = mprofile.get_profile (i); profile->policies (policy_list, ACE_TRY_ENV); ACE_CHECK_RETURN (0); } @@ -1866,11 +1570,11 @@ TAO_ORB_Core::create_stub_object (const TAO_ObjectKey &key, // Iterate over the registered IOR interceptors so that they may be // given the opportunity to add tagged components to the profiles // for this servant. - this->establish_components (mp, policy_list, ACE_TRY_ENV); + this->establish_components (mprofile, policy_list, ACE_TRY_ENV); ACE_CHECK_RETURN (0); // Done creating profiles. Initialize a TAO_Stub object with them. - stub = this->create_stub (type_id, mp, this, ACE_TRY_ENV); + TAO_Stub *stub = this->create_stub (type_id, mprofile, ACE_TRY_ENV); ACE_CHECK_RETURN (stub); stub->base_profiles ().policy_list (policy_list); @@ -2012,9 +1716,6 @@ TAO_ORB_Core::create_collocated_object (TAO_Stub *stub, int TAO_ORB_Core::is_collocated (const TAO_MProfile& mprofile) { - if (this->acceptor_registry_ == 0) - return 0; - // @@ Lots of issues arise when dealing with collocation. What about // forwarding or what if this is a multi-profile IOR where the order is // significant and only one of the profiles is collocated. For example @@ -2026,7 +1727,7 @@ TAO_ORB_Core::is_collocated (const TAO_MProfile& mprofile) // address (ORB Host) but not the object_key. This should be checked // also. - return this->acceptor_registry_->is_collocated (mprofile); + return this->thread_lane_resources_manager ().is_collocated (mprofile); } // **************************************************************** @@ -2034,33 +1735,24 @@ TAO_ORB_Core::is_collocated (const TAO_MProfile& mprofile) TAO_Leader_Follower & TAO_ORB_Core::leader_follower (void) { - return this->reactor_registry_->leader_follower (); + return this->lane_resources ().leader_follower (); } TAO_LF_Strategy & TAO_ORB_Core::lf_strategy (void) { - return this->reactor_registry_->lf_strategy (); + return this->thread_lane_resources_manager ().lf_strategy (); } int TAO_ORB_Core::run (ACE_Time_Value *tv, int perform_work, - CORBA::Environment &ACE_TRY_ENV) + CORBA::Environment &) { if (TAO_debug_level >= 3) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - start of run/perform_work\n"))); - // This method should only be called by servers, so now we set up - // for listening! - - int ret = this->open (ACE_TRY_ENV); - ACE_CHECK_RETURN (-1); - - if (ret == -1) - return -1; - // Fetch the Reactor ACE_Reactor *r = this->reactor (); @@ -2158,14 +1850,17 @@ TAO_ORB_Core::shutdown (CORBA::Boolean wait_for_completion, { this->adapter_registry_.check_close (wait_for_completion, ACE_TRY_ENV); + ACE_CHECK; + this->adapter_registry_.close (wait_for_completion, ACE_TRY_ENV); + ACE_CHECK; // Set the shutdown flag this->has_shutdown_ = 1; - // Shutdown all the reactors.... - this->reactor_registry_->shutdown_all (); + // Shutdown reactor. + this->thread_lane_resources_manager ().shutdown_reactor (); // Grab the thread manager ACE_Thread_Manager *tm = this->thr_mgr (); @@ -2260,31 +1955,10 @@ TAO_ORB_Core::destroy_interceptors (CORBA::Environment &ACE_TRY_ENV) } } -// Set up listening endpoints. -int -TAO_ORB_Core::open (CORBA::Environment &ACE_TRY_ENV) +TAO_Thread_Lane_Resources & +TAO_ORB_Core::lane_resources (void) { - // Double check pattern - if (this->open_called_ == 1) - return 1; - - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, tao_mon, this->open_lock_, -1); - - if (this->open_called_ == 1) - return 1; - - TAO_Acceptor_Registry *ar = this->acceptor_registry (); - // get a reference to the acceptor_registry! - - int ret = ar->open (this, ACE_TRY_ENV); - ACE_CHECK_RETURN (-1); - - if (ret == -1) - return -1; - - this->open_called_ = 1; - - return 0; + return this->thread_lane_resources_manager ().lane_resources (); } void @@ -2861,40 +2535,7 @@ TAO_ORB_Core::create_data_block_i (size_t size, ACE_Reactor * TAO_ORB_Core::reactor (void) { - if (this->reactor_registry_ != 0) - return this->reactor_registry_->reactor (); - - if (this->reactor_ == 0) - { - // Double checked locking - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0); - if (this->reactor_ == 0) - { - this->reactor_ = - this->resource_factory ()->get_reactor (); - } - } - return this->reactor_; -} - -ACE_Reactor * -TAO_ORB_Core::reactor (TAO_Acceptor *acceptor) -{ - if (this->reactor_registry_ != 0) - return this->reactor_registry_->reactor (acceptor); - - // @@ ???? - if (this->reactor_ == 0) - { - // Double checked locking - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0); - if (this->reactor_ == 0) - { - this->reactor_ = - this->resource_factory ()->get_reactor (); - } - } - return this->reactor_; + return this->leader_follower ().reactor (); } CORBA::Object_ptr @@ -3079,16 +2720,6 @@ TAO_ORB_Core::get_cached_policy (TAO_Cached_Policy_Type type) #endif /* (TAO_HAS_CORBA_MESSAGING == 1) */ -void -TAO_ORB_Core::add_poa_extension_initializer (TAO_POA_Extension_Initializer *initializer) -{ - if (this->poa_extension_initializer_) - this->poa_extension_initializer_->add_initializer (initializer); - else - this->poa_extension_initializer_ = initializer; -} - - // **************************************************************** TAO_ORB_Core_TSS_Resources::TAO_ORB_Core_TSS_Resources (void) @@ -3097,11 +2728,9 @@ TAO_ORB_Core_TSS_Resources::TAO_ORB_Core_TSS_Resources (void) output_cdr_msgblock_allocator_ (0), input_cdr_dblock_allocator_ (0), input_cdr_buffer_allocator_ (0), - transport_cache_ (0), event_loop_thread_ (0), client_leader_thread_ (0), - reactor_registry_ (0), - reactor_registry_cookie_ (0), + lane_ (0), ts_objects_ (), orb_core_ (0) { @@ -3129,13 +2758,6 @@ TAO_ORB_Core_TSS_Resources::~TAO_ORB_Core_TSS_Resources (void) this->input_cdr_buffer_allocator_->remove (); delete this->input_cdr_buffer_allocator_; - // UNIMPLEMENTED delete this->transport_cache__; - this->transport_cache_ = 0; - - if (this->reactor_registry_ != 0) - this->reactor_registry_->destroy_tss_cookie ( - this->reactor_registry_cookie_); - //@@ This is broken on platforms that use TSS emulation since this // destructor is invoked after the ORB. Since we're under // pressure to release a beta, we'll have to leak the TSS objects @@ -3213,29 +2835,40 @@ TAO_ORB_Core_instance (void) int -TAO_ORB_Core::collocation_strategy (CORBA::Object_ptr object) +TAO_ORB_Core::collocation_strategy (CORBA::Object_ptr object, + CORBA::Environment &ACE_TRY_ENV) { TAO_Stub *stub = object->_stubobj (); if (!CORBA::is_nil (stub->servant_orb_var ().in ()) && - stub->servant_orb_var ()->orb_core () != 0 && - object->_is_collocated () == 1) + stub->servant_orb_var ()->orb_core () != 0) { - switch (stub->servant_orb_var ()->orb_core ()->get_collocation_strategy ()) + TAO_ORB_Core *orb_core = + stub->servant_orb_var ()->orb_core (); + + int collocated = + orb_core->collocation_resolver ().is_collocated (object, + ACE_TRY_ENV); + ACE_CHECK_RETURN (-1); + + if (collocated) { - case THRU_POA: - return TAO_Collocation_Strategies::CS_THRU_POA_STRATEGY; - - case DIRECT: - { - ///////////////////////////////////////////////////////////// - // If the servant is null and you are collocated this means - // that the POA policy NON-RETAIN is set, and with that policy - // using the DIRECT collocation strategy is just insane. - ///////////////////////////////////////////////////////////// - ACE_ASSERT (object->_servant () != 0); - return TAO_Collocation_Strategies::CS_DIRECT_STRATEGY; - } + switch (stub->servant_orb_var ()->orb_core ()->get_collocation_strategy ()) + { + case THRU_POA: + return TAO_Collocation_Strategies::CS_THRU_POA_STRATEGY; + + case DIRECT: + { + ///////////////////////////////////////////////////////////// + // If the servant is null and you are collocated this means + // that the POA policy NON-RETAIN is set, and with that policy + // using the DIRECT collocation strategy is just insane. + ///////////////////////////////////////////////////////////// + ACE_ASSERT (object->_servant () != 0); + return TAO_Collocation_Strategies::CS_DIRECT_STRATEGY; + } + } } } |