From 0397964836732fcca9bc769fe31f4cc42cff6e49 Mon Sep 17 00:00:00 2001 From: irfan Date: Fri, 3 Aug 2001 01:10:18 +0000 Subject: Obsolete options (-ORBReactorRegistry and the "priority" option with endpoints) should report error. Also, trying to get server protocol policies handled correctly. --- TAO/tao/Acceptor_Registry.cpp | 2 +- TAO/tao/Default_Protocols_Hooks.cpp | 51 +++++++------- TAO/tao/Default_Protocols_Hooks.h | 4 ++ TAO/tao/IIOP_Acceptor.cpp | 10 ++- TAO/tao/PortableServer/Object_Adapter.cpp | 15 ++++ TAO/tao/Protocols_Hooks.h | 9 ++- TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp | 109 ++++++++++++++++++++++-------- TAO/tao/RTCORBA/RT_Protocols_Hooks.h | 6 +- TAO/tao/Strategies/SHMIOP_Acceptor.cpp | 17 +++-- TAO/tao/Strategies/UIOP_Acceptor.cpp | 17 +++-- TAO/tao/Strategies/advanced_resource.cpp | 12 +++- 11 files changed, 183 insertions(+), 69 deletions(-) diff --git a/TAO/tao/Acceptor_Registry.cpp b/TAO/tao/Acceptor_Registry.cpp index 1bfef2863cf..b261d26b399 100644 --- a/TAO/tao/Acceptor_Registry.cpp +++ b/TAO/tao/Acceptor_Registry.cpp @@ -94,7 +94,7 @@ TAO_Acceptor_Registry::get_acceptor (CORBA::ULong tag) for (; acceptor != end ; - acceptor++) + ++acceptor) { if ((*acceptor)->tag () == tag) return *acceptor; diff --git a/TAO/tao/Default_Protocols_Hooks.cpp b/TAO/tao/Default_Protocols_Hooks.cpp index 10b04d66ce5..0badabf5bff 100644 --- a/TAO/tao/Default_Protocols_Hooks.cpp +++ b/TAO/tao/Default_Protocols_Hooks.cpp @@ -24,31 +24,28 @@ TAO_Default_Protocols_Hooks::init_hooks (TAO_ORB_Core *, } int -TAO_Default_Protocols_Hooks::call_client_protocols_hook ( - int &, - int &, - int &, - const char *) +TAO_Default_Protocols_Hooks::call_client_protocols_hook (int &, + int &, + int &, + const char *) { return 0; } int -TAO_Default_Protocols_Hooks::call_server_protocols_hook ( - int &, - int &, - int &, - const char *) +TAO_Default_Protocols_Hooks::call_server_protocols_hook (int &, + int &, + int &, + const char *) { return 0; } void -TAO_Default_Protocols_Hooks::add_rt_service_context_hook ( - TAO_Service_Context &, - CORBA::Policy *, - CORBA::Short &, - CORBA::Environment &) +TAO_Default_Protocols_Hooks::add_rt_service_context_hook (TAO_Service_Context &, + CORBA::Policy *, + CORBA::Short &, + CORBA::Environment &) { } @@ -60,12 +57,11 @@ TAO_Default_Protocols_Hooks::get_selector_hook (CORBA::Policy *, } void -TAO_Default_Protocols_Hooks::get_selector_bands_policy_hook ( - CORBA::Policy *, - CORBA::Short &, - CORBA::Short &, - CORBA::Short &, - int &) +TAO_Default_Protocols_Hooks::get_selector_bands_policy_hook (CORBA::Policy *, + CORBA::Short &, + CORBA::Short &, + CORBA::Short &, + int &) { } @@ -89,11 +85,18 @@ TAO_Default_Protocols_Hooks::set_default_policies (CORBA::Environment &) return 0; } +int +TAO_Default_Protocols_Hooks::set_default_server_protocol_policy (TAO_Acceptor_Registry &, + CORBA::Environment &ACE_TRY_ENV) +{ + return 0; +} + void TAO_Default_Protocols_Hooks::rt_service_context (TAO_Stub *, - TAO_Service_Context &, - CORBA::Boolean , - CORBA::Environment &) + TAO_Service_Context &, + CORBA::Boolean , + CORBA::Environment &) { } diff --git a/TAO/tao/Default_Protocols_Hooks.h b/TAO/tao/Default_Protocols_Hooks.h index 550d3587610..ce1e7b2d473 100644 --- a/TAO/tao/Default_Protocols_Hooks.h +++ b/TAO/tao/Default_Protocols_Hooks.h @@ -71,6 +71,10 @@ public: virtual int set_default_policies (CORBA::Environment &ACE_TRY_ENV); + /// Sets the default ServerProtocolPolicy. + virtual int set_default_server_protocol_policy (TAO_Acceptor_Registry &acceptor_registry, + CORBA::Environment &ACE_TRY_ENV); + }; #if defined (__ACE_INLINE__) diff --git a/TAO/tao/IIOP_Acceptor.cpp b/TAO/tao/IIOP_Acceptor.cpp index 41a7b7391a1..aa9354fb33b 100644 --- a/TAO/tao/IIOP_Acceptor.cpp +++ b/TAO/tao/IIOP_Acceptor.cpp @@ -835,7 +835,15 @@ TAO_IIOP_Acceptor::parse_options (const char *str) ACE_TEXT ("option name.\n")), -1); - if (name == "portspan") + if (name == "priority") + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) Invalid IIOP endpoint format: ") + ACE_TEXT ("endpoint priorities no longer supported. \n"), + value.c_str ()), + -1); + } + else if (name == "portspan") { int range = ACE_static_cast (int, ACE_OS::atoi (value.c_str ())); // @@ What's the lower bound on the range? zero, or one? diff --git a/TAO/tao/PortableServer/Object_Adapter.cpp b/TAO/tao/PortableServer/Object_Adapter.cpp index c76db656fc7..c820ed01f71 100644 --- a/TAO/tao/PortableServer/Object_Adapter.cpp +++ b/TAO/tao/PortableServer/Object_Adapter.cpp @@ -22,6 +22,7 @@ #include "tao/PortableInterceptor.h" #include "tao/POA_Extension_Initializer.h" #include "tao/Thread_Lane_Resources_Manager.h" +#include "tao/Thread_Lane_Resources.h" #if !defined (__ACE_INLINE__) # include "Object_Adapter.i" @@ -600,6 +601,20 @@ TAO_Object_Adapter::open (CORBA::Environment &ACE_TRY_ENV) this->orb_core_.thread_lane_resources_manager ().open_default_resources (ACE_TRY_ENV); ACE_CHECK; + TAO_Thread_Lane_Resources &default_lane_resources = + this->orb_core_.thread_lane_resources_manager ().default_lane_resources (); + + TAO_Acceptor_Registry &acceptor_registry = + default_lane_resources.acceptor_registry (); + + TAO_Protocols_Hooks *protocols_hooks = + this->orb_core_.get_protocols_hooks (ACE_TRY_ENV); + ACE_CHECK; + + protocols_hooks->set_default_server_protocol_policy (acceptor_registry, + ACE_TRY_ENV); + ACE_CHECK; + // Construct a new POA TAO_POA::String root_poa_name (TAO_DEFAULT_ROOTPOA_NAME); this->root_ = this->servant_dispatcher_->create_POA (root_poa_name, diff --git a/TAO/tao/Protocols_Hooks.h b/TAO/tao/Protocols_Hooks.h index a5a6326449d..590a20877af 100644 --- a/TAO/tao/Protocols_Hooks.h +++ b/TAO/tao/Protocols_Hooks.h @@ -27,6 +27,7 @@ class TAO_ORB_Core; class TAO_GIOP_Invocation; class TAO_Resource_Factory; class TAO_Service_Context; +class TAO_Acceptor_Registry; class TAO_Export TAO_Protocols_Hooks : public ACE_Service_Object { @@ -87,9 +88,13 @@ public: /// Sets the default_policies for ORB. /// 1. Sets ORB-level policy defaults for this ORB. Currently sets - /// default RTCORBA policies: ServerProtocolPolicy and - /// ClientProtocolPolicy. + /// default RTCORBA policies: ClientProtocolPolicy. virtual int set_default_policies (CORBA::Environment &ACE_TRY_ENV) = 0; + + /// Sets the default ServerProtocolPolicy. + virtual int set_default_server_protocol_policy (TAO_Acceptor_Registry &acceptor_registry, + CORBA::Environment &ACE_TRY_ENV) = 0; + }; #include "ace/post.h" diff --git a/TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp b/TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp index d3aac342edb..7a345f5932c 100644 --- a/TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp +++ b/TAO/tao/RTCORBA/RT_Protocols_Hooks.cpp @@ -6,6 +6,8 @@ #include "tao/Invocation.h" #include "tao/Stub.h" #include "tao/MProfile.h" +#include "tao/Acceptor_Registry.h" +#include "tao/Thread_Lane_Resources.h" #include "Priority_Mapping_Manager.h" #include "RT_Stub.h" @@ -28,7 +30,7 @@ TAO_RT_Protocols_Hooks::~TAO_RT_Protocols_Hooks (void) { } -void +void TAO_RT_Protocols_Hooks::init_hooks (TAO_ORB_Core *orb_core, CORBA::Environment &ACE_TRY_ENV) { @@ -36,9 +38,8 @@ TAO_RT_Protocols_Hooks::init_hooks (TAO_ORB_Core *orb_core, // Save a reference to the priority mapping manager. CORBA::Object_var obj = - orb_core->object_ref_table ().resolve_initial_references ( - TAO_OBJID_PRIORITYMAPPINGMANAGER, - ACE_TRY_ENV); + orb_core->object_ref_table ().resolve_initial_references (TAO_OBJID_PRIORITYMAPPINGMANAGER, + ACE_TRY_ENV); ACE_CHECK; this->mapping_manager_ = @@ -48,11 +49,10 @@ TAO_RT_Protocols_Hooks::init_hooks (TAO_ORB_Core *orb_core, } int -TAO_RT_Protocols_Hooks::call_client_protocols_hook ( - int &send_buffer_size, - int &recv_buffer_size, - int &no_delay, - const char *protocol_type) +TAO_RT_Protocols_Hooks::call_client_protocols_hook (int &send_buffer_size, + int &recv_buffer_size, + int &no_delay, + const char *protocol_type) { if (TAO_RT_Protocols_Hooks::client_protocols_hook_ == 0) return -1; @@ -74,11 +74,10 @@ TAO_RT_Protocols_Hooks::set_client_protocols_hook (Client_Protocols_Hook hook) } int -TAO_RT_Protocols_Hooks::call_server_protocols_hook ( - int &send_buffer_size, - int &recv_buffer_size, - int &no_delay, - const char *protocol_type) +TAO_RT_Protocols_Hooks::call_server_protocols_hook (int &send_buffer_size, + int &recv_buffer_size, + int &no_delay, + const char *protocol_type) { if (TAO_RT_Protocols_Hooks::server_protocols_hook_ == 0) return -1; @@ -180,9 +179,9 @@ TAO_RT_Protocols_Hooks::add_rt_service_context_hook (TAO_Service_Context &servic void TAO_RT_Protocols_Hooks::get_selector_hook ( - CORBA::Policy *model_policy, - CORBA::Boolean &is_client_propagated, - CORBA::Short &server_priority) + CORBA::Policy *model_policy, + CORBA::Boolean &is_client_propagated, + CORBA::Short &server_priority) { RTCORBA::PriorityModelPolicy_var model_policy_ptr = @@ -204,11 +203,11 @@ TAO_RT_Protocols_Hooks::get_selector_hook ( void TAO_RT_Protocols_Hooks::get_selector_bands_policy_hook ( - CORBA::Policy *bands_policy, - CORBA::Short &min_priority, - CORBA::Short &max_priority, - CORBA::Short &p, - int &in_range) + CORBA::Policy *bands_policy, + CORBA::Short &min_priority, + CORBA::Short &max_priority, + CORBA::Short &p, + int &in_range) { RTCORBA::PriorityBandedConnectionPolicy_var bands_policy_ptr = RTCORBA::PriorityBandedConnectionPolicy::_narrow (bands_policy); @@ -289,13 +288,12 @@ int TAO_RT_Protocols_Hooks::set_default_policies (CORBA::Environment &ACE_TRY_ENV) { // Set RTCORBA policy defaults. - // Set RTCORBA::ServerProtocolPolicy and - // RTCORBA::ClientProtocolPolicy defaults to include all protocols - // that were loaded into this ORB. - // First, create a protocol list. + // + // Set RTCORBA::ClientProtocolPolicy defaults to include all + // protocols that were loaded into this ORB. + // First, create a protocol list. TAO_ProtocolFactorySet *pfs = this->orb_core_->protocol_factories (); - RTCORBA::ProtocolList protocols; protocols.length (pfs->size ()); @@ -345,7 +343,60 @@ TAO_RT_Protocols_Hooks::set_default_policies (CORBA::Environment &ACE_TRY_ENV) client_protocol_policy; this->orb_core_->get_default_policies ()->set_policy (client_protocol_policy, - ACE_TRY_ENV); + ACE_TRY_ENV); + ACE_CHECK_RETURN (-1); + + return 0; +} + +int +TAO_RT_Protocols_Hooks::set_default_server_protocol_policy (TAO_Acceptor_Registry &acceptor_registry, + CORBA::Environment &ACE_TRY_ENV) +{ + RTCORBA::ProtocolList protocols; + + TAO_AcceptorSetIterator end = + acceptor_registry.end (); + + for (TAO_AcceptorSetIterator acceptor = + acceptor_registry.begin (); + acceptor != end; + ++acceptor) + { + if (*acceptor == 0) + continue; + + CORBA::ULong current_length = + protocols.length (); + + protocols.length (current_length + 1); + + protocols[current_length].protocol_type = + (*acceptor)->tag (); + + protocols[current_length].orb_protocol_properties = + RTCORBA::ProtocolProperties::_nil (); + + // @@ Later, we will likely migrate to using RTCORBA protocol + // policies for configuration of protocols in nonRT use cases. + // Then, the code below will change to each protocol factory + // being responsible for creation of its own default protocol + // properties. + protocols[current_length].transport_protocol_properties = + TAO_Protocol_Properties_Factory::create_transport_protocol_property ((*acceptor)->tag ()); + } + + // Set ServerProtocolPolicy. + TAO_ServerProtocolPolicy *server_protocol_policy = 0; + ACE_NEW_RETURN (server_protocol_policy, + TAO_ServerProtocolPolicy (protocols), + -1); + + RTCORBA::ServerProtocolPolicy_var safe_server_protocol_policy = + server_protocol_policy; + + this->orb_core_->get_default_policies ()->set_policy (server_protocol_policy, + ACE_TRY_ENV); ACE_CHECK_RETURN (-1); return 0; @@ -368,5 +419,3 @@ template class ACE_Dynamic_Service; #pragma instantiate ACE_Dynamic_Service #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - - diff --git a/TAO/tao/RTCORBA/RT_Protocols_Hooks.h b/TAO/tao/RTCORBA/RT_Protocols_Hooks.h index 303809d9edf..4d97b34f5dc 100644 --- a/TAO/tao/RTCORBA/RT_Protocols_Hooks.h +++ b/TAO/tao/RTCORBA/RT_Protocols_Hooks.h @@ -125,10 +125,12 @@ public: //@} /// 1. Sets ORB-level policy defaults for this ORB. Currently sets - /// default RTCORBA policies: ServerProtocolPolicy and - /// ClientProtocolPolicy. + /// default RTCORBA policies: ClientProtocolPolicy. virtual int set_default_policies (CORBA::Environment &ACE_TRY_ENV); + int set_default_server_protocol_policy (TAO_Acceptor_Registry &acceptor_registry, + CORBA::Environment &ACE_TRY_ENV); + protected: TAO_ORB_Core *orb_core_; diff --git a/TAO/tao/Strategies/SHMIOP_Acceptor.cpp b/TAO/tao/Strategies/SHMIOP_Acceptor.cpp index 36b02bc47eb..4a1cd5687ad 100644 --- a/TAO/tao/Strategies/SHMIOP_Acceptor.cpp +++ b/TAO/tao/Strategies/SHMIOP_Acceptor.cpp @@ -483,10 +483,19 @@ TAO_SHMIOP_Acceptor::parse_options (const char *str) ACE_TEXT ("option name.\n")), -1); - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("TAO (%P|%t) Invalid SHMIOP option: <%s>\n"), - name.c_str ()), - -1); + if (name == "priority") + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) Invalid IIOP endpoint format: ") + ACE_TEXT ("endpoint priorities no longer supported. \n"), + value.c_str ()), + -1); + } + else + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) Invalid SHMIOP option: <%s>\n"), + name.c_str ()), + -1); } } return 0; diff --git a/TAO/tao/Strategies/UIOP_Acceptor.cpp b/TAO/tao/Strategies/UIOP_Acceptor.cpp index 516289b207e..a63ce6ecebf 100644 --- a/TAO/tao/Strategies/UIOP_Acceptor.cpp +++ b/TAO/tao/Strategies/UIOP_Acceptor.cpp @@ -509,10 +509,19 @@ TAO_UIOP_Acceptor::parse_options (const char *str) "option name.\n"), -1); - ACE_ERROR_RETURN ((LM_ERROR, - "TAO (%P|%t) Invalid UIOP option: <%s>\n", - name.c_str ()), - -1); + if (name == "priority") + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) Invalid IIOP endpoint format: ") + ACE_TEXT ("endpoint priorities no longer supported. \n"), + value.c_str ()), + -1); + } + else + ACE_ERROR_RETURN ((LM_ERROR, + "TAO (%P|%t) Invalid UIOP option: <%s>\n", + name.c_str ()), + -1); } } return 0; diff --git a/TAO/tao/Strategies/advanced_resource.cpp b/TAO/tao/Strategies/advanced_resource.cpp index 1f2d8b20d22..1b58f8feb8f 100644 --- a/TAO/tao/Strategies/advanced_resource.cpp +++ b/TAO/tao/Strategies/advanced_resource.cpp @@ -65,7 +65,17 @@ TAO_Advanced_Resource_Factory::init (int argc, char **argv) for (curarg = 0; curarg < argc; curarg++) if (ACE_OS::strcasecmp (argv[curarg], - "-ORBReactorLock") == 0) + "-ORBReactorRegistry") == 0) + { + curarg++; + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("TAO_Advanced_Resource_Factory::init - ") + ACE_TEXT ("-ORBReactorRegistry no longer supported\n")), + -1); + } + + else if (ACE_OS::strcasecmp (argv[curarg], + "-ORBReactorLock") == 0) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO_Default_Resource obsolete -ORBReactorLock ") -- cgit v1.2.1