diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-08-02 22:01:11 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-08-02 22:01:11 +0000 |
commit | 4bff75797c7e0186d9e50285dc2a1784edd352dc (patch) | |
tree | 112c2833174dc59c4683475ff4a8f6102e8bb5da | |
parent | d6d2acc2e41c1e4b592b2cb33e61dac266cca297 (diff) | |
download | ATCD-4bff75797c7e0186d9e50285dc2a1784edd352dc.tar.gz |
Acceptor are no longer associated with priorities...
34 files changed, 459 insertions, 583 deletions
diff --git a/TAO/tao/Acceptor_Filter.h b/TAO/tao/Acceptor_Filter.h index be87e6acb81..594b1e909de 100644 --- a/TAO/tao/Acceptor_Filter.h +++ b/TAO/tao/Acceptor_Filter.h @@ -52,10 +52,11 @@ public: * selected acceptors (endpoints) from the array delimited by * <acceptors_begin> and <acceptors_end>. */ - virtual int fill_mprofile (const TAO_ObjectKey &object_key, - TAO_MProfile &mprofile, - TAO_Acceptor **acceptors_begin, - TAO_Acceptor **acceptors_end) = 0; + virtual int fill_profile (const TAO_ObjectKey &object_key, + TAO_MProfile &mprofile, + TAO_Acceptor **acceptors_begin, + TAO_Acceptor **acceptors_end, + CORBA::Short priority = TAO_INVALID_PRIORITY) = 0; /// Encodes the endpoints in the profiles into the TAO_TAG_ENDPOINTS /// tag component of profiles. diff --git a/TAO/tao/Default_Protocols_Hooks.h b/TAO/tao/Default_Protocols_Hooks.h index 513286b1505..550d3587610 100644 --- a/TAO/tao/Default_Protocols_Hooks.h +++ b/TAO/tao/Default_Protocols_Hooks.h @@ -24,7 +24,7 @@ class TAO_Export TAO_Default_Protocols_Hooks : public TAO_Protocols_Hooks { - public: +public: /// destructor virtual ~TAO_Default_Protocols_Hooks (void); @@ -57,18 +57,17 @@ class TAO_Export TAO_Default_Protocols_Hooks : public TAO_Protocols_Hooks &is_client_propagated, CORBA::Short &server_priority); - virtual void get_selector_bands_policy_hook ( - CORBA::Policy *bands_policy, - CORBA::Short &min_priority, - CORBA::Short &max_priority, - CORBA::Short &p, - int &in_range); + virtual void get_selector_bands_policy_hook (CORBA::Policy *bands_policy, + CORBA::Short &min_priority, + CORBA::Short &max_priority, + CORBA::Short &p, + int &in_range); virtual int get_thread_priority (CORBA::Short &, - CORBA::Environment &); + CORBA::Environment &); virtual int set_thread_priority (CORBA::Short, - CORBA::Environment &); + CORBA::Environment &); virtual int set_default_policies (CORBA::Environment &ACE_TRY_ENV); diff --git a/TAO/tao/Endpoint.h b/TAO/tao/Endpoint.h index e5602a279ca..7dd2456a4fe 100644 --- a/TAO/tao/Endpoint.h +++ b/TAO/tao/Endpoint.h @@ -43,7 +43,7 @@ class TAO_Export TAO_Endpoint public: /// Constructor. TAO_Endpoint (CORBA::ULong tag, - CORBA::Short priority = -1); + CORBA::Short priority = TAO_INVALID_PRIORITY); /// Destructor. virtual ~TAO_Endpoint (void); diff --git a/TAO/tao/IIOP_Acceptor.cpp b/TAO/tao/IIOP_Acceptor.cpp index d2908eaacb2..41a7b7391a1 100644 --- a/TAO/tao/IIOP_Acceptor.cpp +++ b/TAO/tao/IIOP_Acceptor.cpp @@ -84,9 +84,9 @@ TAO_IIOP_Acceptor::~TAO_IIOP_Acceptor (void) // TODO = // 2) For V1.[1,2] there are tagged components int -TAO_IIOP_Acceptor::create_mprofile (const TAO_ObjectKey &object_key, - TAO_MProfile &mprofile, - CORBA::Boolean share_profile) +TAO_IIOP_Acceptor::create_profile (const TAO_ObjectKey &object_key, + TAO_MProfile &mprofile, + CORBA::Short priority) { // Sanity check. if (this->endpoint_count_ == 0) @@ -94,17 +94,18 @@ TAO_IIOP_Acceptor::create_mprofile (const TAO_ObjectKey &object_key, // Check if multiple endpoints should be put in one profile or // if they should be spread across multiple profiles. - if (share_profile == 1) - return this->create_shared_profile (object_key, - mprofile); - else - return this->create_new_profiles (object_key, + if (priority == TAO_INVALID_PRIORITY) + return this->create_new_profile (object_key, mprofile); + else + return this->create_shared_profile (object_key, + mprofile, + priority); } int -TAO_IIOP_Acceptor::create_new_profiles (const TAO_ObjectKey &object_key, - TAO_MProfile &mprofile) +TAO_IIOP_Acceptor::create_new_profile (const TAO_ObjectKey &object_key, + TAO_MProfile &mprofile) { // Adding this->endpoint_count_ to the TAO_MProfile. int count = mprofile.profile_count (); @@ -150,7 +151,8 @@ TAO_IIOP_Acceptor::create_new_profiles (const TAO_ObjectKey &object_key, int TAO_IIOP_Acceptor::create_shared_profile (const TAO_ObjectKey &object_key, - TAO_MProfile &mprofile) + TAO_MProfile &mprofile, + CORBA::Short priority) { size_t index = 0; TAO_Profile *pfile = 0; @@ -161,11 +163,11 @@ TAO_IIOP_Acceptor::create_shared_profile (const TAO_ObjectKey &object_key, { pfile = mprofile.get_profile (i); if (pfile->tag () == TAO_TAG_IIOP_PROFILE) - { - iiop_profile = ACE_dynamic_cast (TAO_IIOP_Profile *, - pfile); - break; - } + { + iiop_profile = ACE_dynamic_cast (TAO_IIOP_Profile *, + pfile); + break; + } } // If <mprofile> doesn't contain a IIOP_Profile, we need to create @@ -180,7 +182,7 @@ TAO_IIOP_Acceptor::create_shared_profile (const TAO_ObjectKey &object_key, this->version_, this->orb_core_), -1); - iiop_profile->endpoint ()->priority (this->priority ()); + iiop_profile->endpoint ()->priority (priority); if (mprofile.give_profile (iiop_profile) == -1) { @@ -215,7 +217,7 @@ TAO_IIOP_Acceptor::create_shared_profile (const TAO_ObjectKey &object_key, this->addrs_[index].get_port_number (), this->addrs_[index]), -1); - endpoint->priority (this->priority_); + endpoint->priority (priority); iiop_profile->add_endpoint (endpoint); } @@ -544,27 +546,27 @@ TAO_IIOP_Acceptor::hostname (TAO_ORB_Core *orb_core, return this->dotted_decimal_address (addr, host); } else - if (specified_hostname != 0) - { - // If the user specified a hostname, pass it back - // blindly as it overrides our choice of hostname. - host = CORBA::string_dup (specified_hostname); - } - else - { - char tmp_host[MAXHOSTNAMELEN + 1]; - - // Get the hostname associated with our address - if (addr.get_host_name (tmp_host, sizeof (tmp_host)) != 0) - { - // On failure, just return the decimal address. - return this->dotted_decimal_address (addr, host); - } - else - { - host = CORBA::string_dup (tmp_host); - } - } + if (specified_hostname != 0) + { + // If the user specified a hostname, pass it back + // blindly as it overrides our choice of hostname. + host = CORBA::string_dup (specified_hostname); + } + else + { + char tmp_host[MAXHOSTNAMELEN + 1]; + + // Get the hostname associated with our address + if (addr.get_host_name (tmp_host, sizeof (tmp_host)) != 0) + { + // On failure, just return the decimal address. + return this->dotted_decimal_address (addr, host); + } + else + { + host = CORBA::string_dup (tmp_host); + } + } return 0; } @@ -722,16 +724,16 @@ TAO_IIOP_Acceptor::object_key (IOP::TaggedProfile &profile, // processing. if (!(cdr.read_octet (major) && cdr.read_octet (minor))) - { - if (TAO_debug_level > 0) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) IIOP_Profile::decode - v%d.%d\n"), - major, - minor)); - } - return -1; - } + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) IIOP_Profile::decode - v%d.%d\n"), + major, + minor)); + } + return -1; + } CORBA::String_var host; CORBA::UShort port = 0; @@ -833,26 +835,7 @@ TAO_IIOP_Acceptor::parse_options (const char *str) ACE_TEXT ("option name.\n")), -1); - if (name == "priority") - { - CORBA::Short corba_priority = - ACE_static_cast (CORBA::Short, - ACE_OS::atoi (value.c_str ())); - - if (corba_priority >= 0 - /* && corba_priority < 32768 */) - // priority_ and corba_priority will always be less - // than 32768 since CORBA::Short is a signed 16 bit - // integer. - this->priority_ = corba_priority; - else - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("TAO (%P|%t) Invalid IIOP endpoint ") - ACE_TEXT ("priority: <%s>\n"), - value.c_str ()), - -1); - } - else if (name == "portspan") + 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/IIOP_Acceptor.h b/TAO/tao/IIOP_Acceptor.h index ad202abfa9e..a2dfeb5edcc 100644 --- a/TAO/tao/IIOP_Acceptor.h +++ b/TAO/tao/IIOP_Acceptor.h @@ -78,9 +78,9 @@ public: int version_minor, const char *options = 0); virtual int close (void); - virtual int create_mprofile (const TAO_ObjectKey &object_key, - TAO_MProfile &mprofile, - CORBA::Boolean share_profile); + virtual int create_profile (const TAO_ObjectKey &object_key, + TAO_MProfile &mprofile, + CORBA::Short priority); virtual int is_collocated (const TAO_Endpoint *endpoint); virtual CORBA::ULong endpoint_count (void); @@ -129,7 +129,6 @@ protected: * Parse protocol specific options. * * Currently supported: - * priority -- specifies the RT CORBA priority for the endpoint * portspan -- specifies the range of ports over which the acceptor * should scan looking for a free port (this is convenient * for situations where you might normally use an ephemeral @@ -144,13 +143,14 @@ protected: /// Helper method to add a new profile to the mprofile for /// each endpoint. - int create_new_profiles (const TAO_ObjectKey &object_key, - TAO_MProfile &mprofile); + int create_new_profile (const TAO_ObjectKey &object_key, + TAO_MProfile &mprofile); /// Helper method to create a profile that contains all of /// our endpoints. int create_shared_profile (const TAO_ObjectKey &object_key, - TAO_MProfile &mprofile); + TAO_MProfile &mprofile, + CORBA::Short priority); protected: diff --git a/TAO/tao/Pluggable.cpp b/TAO/tao/Pluggable.cpp index 36b84e84057..a4fe66973b7 100644 --- a/TAO/tao/Pluggable.cpp +++ b/TAO/tao/Pluggable.cpp @@ -209,8 +209,7 @@ TAO_Connector::make_mprofile (const char *string, // Acceptor TAO_Acceptor::TAO_Acceptor (CORBA::ULong tag) - : priority_ (-1), - tag_ (tag) + : tag_ (tag) { } diff --git a/TAO/tao/Pluggable.h b/TAO/tao/Pluggable.h index cf89effe709..cc7fd5445c5 100644 --- a/TAO/tao/Pluggable.h +++ b/TAO/tao/Pluggable.h @@ -70,9 +70,6 @@ public: /// The tag, each concrete class will have a specific tag value. CORBA::ULong tag (void) const; - /// The priority for this endpoint. - CORBA::Short priority (void) const; - /// Method to initialize acceptor for address. virtual int open (TAO_ORB_Core *orb_core, ACE_Reactor *reactor, @@ -104,9 +101,9 @@ public: * in the mprofile that is of the same type. Currently, this * is used when RT CORBA is enabled. */ - virtual int create_mprofile (const TAO_ObjectKey &object_key, - TAO_MProfile &mprofile, - CORBA::Boolean share_profile) = 0; + virtual int create_profile (const TAO_ObjectKey &object_key, + TAO_MProfile &mprofile, + CORBA::Short priority) = 0; /// Return 1 if the <endpoint> has the same address as the acceptor. virtual int is_collocated (const TAO_Endpoint* endpoint) = 0; @@ -128,10 +125,6 @@ public: virtual int object_key (IOP::TaggedProfile &profile, TAO_ObjectKey &key) = 0; -protected: - /// The priority for this endpoint - CORBA::Short priority_; - private: /// IOP protocol tag. CORBA::ULong tag_; diff --git a/TAO/tao/Pluggable.i b/TAO/tao/Pluggable.i index 47443ee705f..a3fe15fa9a1 100644 --- a/TAO/tao/Pluggable.i +++ b/TAO/tao/Pluggable.i @@ -27,9 +27,3 @@ TAO_Acceptor::tag (void) const { return this->tag_; } - -ACE_INLINE CORBA::Short -TAO_Acceptor::priority (void) const -{ - return this->priority_; -} diff --git a/TAO/tao/PortableServer/Default_Acceptor_Filter.cpp b/TAO/tao/PortableServer/Default_Acceptor_Filter.cpp index b55e3005a5d..f4608e2cad3 100644 --- a/TAO/tao/PortableServer/Default_Acceptor_Filter.cpp +++ b/TAO/tao/PortableServer/Default_Acceptor_Filter.cpp @@ -10,19 +10,19 @@ TAO_Default_Acceptor_Filter::TAO_Default_Acceptor_Filter (void) } int -TAO_Default_Acceptor_Filter::fill_mprofile (const TAO_ObjectKey &object_key, - TAO_MProfile &mprofile, - TAO_Acceptor **acceptors_begin, - TAO_Acceptor **acceptors_end) +TAO_Default_Acceptor_Filter::fill_profile (const TAO_ObjectKey &object_key, + TAO_MProfile &mprofile, + TAO_Acceptor **acceptors_begin, + TAO_Acceptor **acceptors_end, + CORBA::Short priority) { for (TAO_Acceptor** acceptor = acceptors_begin; acceptor != acceptors_end; ++acceptor) { - if ((*acceptor)->create_mprofile (object_key, - mprofile, - 0 /* one endpoint per profile */) - == -1) + if ((*acceptor)->create_profile (object_key, + mprofile, + priority) == -1) return -1; } diff --git a/TAO/tao/PortableServer/Default_Acceptor_Filter.h b/TAO/tao/PortableServer/Default_Acceptor_Filter.h index 737888a0992..be6f0e000e3 100644 --- a/TAO/tao/PortableServer/Default_Acceptor_Filter.h +++ b/TAO/tao/PortableServer/Default_Acceptor_Filter.h @@ -53,10 +53,11 @@ public: TAO_Default_Acceptor_Filter (void); /// Populate <mprofile> with all available endpoints. - int fill_mprofile (const TAO_ObjectKey &object_key, - TAO_MProfile &mprofile, - TAO_Acceptor **acceptors_begin, - TAO_Acceptor **acceptors_end); + int fill_profile (const TAO_ObjectKey &object_key, + TAO_MProfile &mprofile, + TAO_Acceptor **acceptors_begin, + TAO_Acceptor **acceptors_end, + CORBA::Short priority); /// Encodes the endpoints in the profiles into the TAO_TAG_ENDPOINTS /// tag component of profiles. diff --git a/TAO/tao/PortableServer/Object_Adapter.h b/TAO/tao/PortableServer/Object_Adapter.h index 0005ad5594d..13f1c3d515c 100644 --- a/TAO/tao/PortableServer/Object_Adapter.h +++ b/TAO/tao/PortableServer/Object_Adapter.h @@ -676,6 +676,9 @@ public: void using_servant_locator (void); // We are using the servant locator for this upcall. + CORBA::Short priority (void) const; + // Get the priority for the current upcall. + protected: void servant_locator_cleanup (void); diff --git a/TAO/tao/PortableServer/Object_Adapter.i b/TAO/tao/PortableServer/Object_Adapter.i index d47e33b69f1..5c9803645a0 100644 --- a/TAO/tao/PortableServer/Object_Adapter.i +++ b/TAO/tao/PortableServer/Object_Adapter.i @@ -313,3 +313,9 @@ TAO_POA_Current_Impl::priority (void) const { return this->priority_; } + +ACE_INLINE CORBA::Short +TAO_Object_Adapter::Servant_Upcall::priority (void) const +{ + return this->current_context_.priority (); +} diff --git a/TAO/tao/PortableServer/POA.cpp b/TAO/tao/PortableServer/POA.cpp index 9523ebedb71..48b45400f33 100644 --- a/TAO/tao/PortableServer/POA.cpp +++ b/TAO/tao/PortableServer/POA.cpp @@ -3278,10 +3278,10 @@ TAO_POA::create_stub_object (const TAO_ObjectKey &object_key, if (!error) { result = - filter->fill_mprofile (object_key, - mprofile, - acceptor_registry.begin (), - acceptor_registry.end ()); + filter->fill_profile (object_key, + mprofile, + acceptor_registry.begin (), + acceptor_registry.end ()); if (result == -1) error = 1; } diff --git a/TAO/tao/PortableServer/POA.h b/TAO/tao/PortableServer/POA.h index 8b57b244be4..b7b1e559098 100644 --- a/TAO/tao/PortableServer/POA.h +++ b/TAO/tao/PortableServer/POA.h @@ -390,6 +390,8 @@ public: /// Accessor for the current thread policy of this POA. PortableServer::ThreadPolicyValue thread_policy (void) const; + virtual void *thread_pool (void) const; + protected: const ACE_CString &name (void) const; diff --git a/TAO/tao/PortableServer/POA.i b/TAO/tao/PortableServer/POA.i index e5d7c02ddc8..e6fb4fd073b 100644 --- a/TAO/tao/PortableServer/POA.i +++ b/TAO/tao/PortableServer/POA.i @@ -611,3 +611,8 @@ TAO_POA::cached_policies (void) return this->cached_policies_; } +ACE_INLINE void * +TAO_POA::thread_pool (void) const +{ + return 0; +} diff --git a/TAO/tao/Protocols_Hooks.h b/TAO/tao/Protocols_Hooks.h index 6447f43d6f4..a5a6326449d 100644 --- a/TAO/tao/Protocols_Hooks.h +++ b/TAO/tao/Protocols_Hooks.h @@ -64,12 +64,11 @@ public: &is_client_propagated, CORBA::Short &server_priority) = 0; - virtual void get_selector_bands_policy_hook ( - CORBA::Policy *bands_policy, - CORBA::Short &min_priority, - CORBA::Short &max_priority, - CORBA::Short &p, - int &in_range) = 0; + virtual void get_selector_bands_policy_hook (CORBA::Policy *bands_policy, + CORBA::Short &min_priority, + CORBA::Short &max_priority, + CORBA::Short &p, + int &in_range) = 0; /** * Accessor and modifier to the current thread priority, used to @@ -79,10 +78,10 @@ public: */ //@{ virtual int get_thread_priority (CORBA::Short &, - CORBA::Environment &) = 0; + CORBA::Environment &) = 0; virtual int set_thread_priority (CORBA::Short, - CORBA::Environment &) = 0; + CORBA::Environment &) = 0; //@} diff --git a/TAO/tao/RTCORBA/Pool_Per_Endpoint.cpp b/TAO/tao/RTCORBA/Pool_Per_Endpoint.cpp deleted file mode 100644 index 6dbd6bfa4cc..00000000000 --- a/TAO/tao/RTCORBA/Pool_Per_Endpoint.cpp +++ /dev/null @@ -1,105 +0,0 @@ -// $Id$ - -#include "Pool_Per_Endpoint.h" -#include "tao/ORB.h" -#include "tao/ORB_Core.h" -#include "tao/Acceptor_Registry.h" -#include "tao/Thread_Lane_Resources.h" -#include "tao/Pluggable.h" -#include "Priority_Mapping_Manager.h" -#include "tao/debug.h" -#include "ace/Sched_Params.h" - -#if !defined (__ACE_INLINE__) -# include "Pool_Per_Endpoint.i" -#endif /* ! __ACE_INLINE__ */ - -ACE_RCSID(tao, Pool_Per_Endpoint, "$Id$") - -TAO_Pool_Per_Endpoint::TAO_Pool_Per_Endpoint (CORBA::ORB_ptr orb, - int policy, - int poolsize, - int flags) - : orb_ (CORBA::ORB::_duplicate (orb)), - policy_ (policy), - poolsize_ (poolsize), - flags_ (flags) -{ - this->thr_mgr (&this->thread_manager_); -} - -TAO_Pool_Per_Endpoint::~TAO_Pool_Per_Endpoint (void) -{ -} - -void -TAO_Pool_Per_Endpoint::run (CORBA::Environment &ACE_TRY_ENV) -{ - CORBA::Object_var obj = - this->orb_->resolve_initial_references (TAO_OBJID_PRIORITYMAPPINGMANAGER, - ACE_TRY_ENV); - - TAO_Priority_Mapping_Manager_var mapping_manager = - TAO_Priority_Mapping_Manager::_narrow (obj.in (), - ACE_TRY_ENV); - ACE_CHECK; - - RTCORBA::PriorityMapping *pm = - mapping_manager.in ()->mapping (); - - TAO_Acceptor_Registry &ac = - this->orb_->orb_core ()->lane_resources ().acceptor_registry (); - - for (TAO_AcceptorSetIterator i = ac.begin (); i != ac.end (); ++i) - { - int priority = - ACE_Sched_Params::priority_min (this->policy_); - - const CORBA::Short corba_priority = (*i)->priority (); - CORBA::Short native_priority; - if (pm->to_native (corba_priority, native_priority) == 1) - priority = native_priority; - else - ACE_THROW (CORBA::DATA_CONVERSION ()); - - if (TAO_debug_level > 3) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) - creating thread at ") - ACE_TEXT ("priority %d:%d\n"), - priority, - corba_priority)); - - if (this->activate (this->flags_, - this->poolsize_, /* number of threads */ - 1, /* force active */ - priority) == -1) - { - ACE_THROW (CORBA::INTERNAL ()); - } - } - this->thread_manager_.wait (); -} - -int -TAO_Pool_Per_Endpoint::svc (void) -{ - if (TAO_debug_level > 3) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) - TAO_Pool_Per_Endpoint::svc: ") - ACE_TEXT (" using reactor <%x> in this thread\n"), - this->orb_->orb_core ()->reactor ())); - - this->orb_->run (); // @@ Where's the error/exception check? - - if (TAO_debug_level > 3) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) - TAO_Pool_Per_Endpoint::svc: ") - ACE_TEXT (" ORB::run() finished\n"))); - return 0; -} - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/tao/RTCORBA/Pool_Per_Endpoint.h b/TAO/tao/RTCORBA/Pool_Per_Endpoint.h deleted file mode 100644 index 34478d5dae1..00000000000 --- a/TAO/tao/RTCORBA/Pool_Per_Endpoint.h +++ /dev/null @@ -1,79 +0,0 @@ - -//============================================================================= -/** - * @file Pool_Per_Endpoint.h - * - * $Id$ - * - * @author Carlos O'Ryan (coryan@cs.wustl.edu) - */ -//============================================================================= - - -#ifndef TAO_POOL_PER_ENDPOINT_H -#define TAO_POOL_PER_ENDPOINT_H -#include "ace/pre.h" - -#include "rtcorba_export.h" -#include "tao/ORB.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Task.h" - -/** - * @class TAO_Pool_Per_Endpoint - * - * @brief The Pool_Per_Endpoint concurrency strategy. - * - * This strategy creates a separate thread pool for each endpoint - * in the system. It is a helper class to manage and create the - * required threads. - * It should be used with the Reactor_Per_Endpoint registry - * configured. - */ -class TAO_RTCORBA_Export TAO_Pool_Per_Endpoint : public ACE_Task_Base -{ -public: - /// Constructor - TAO_Pool_Per_Endpoint (CORBA::ORB_ptr orb, - int policy = ACE_SCHED_OTHER, - int poolsize = 1, - int flags = - THR_BOUND|THR_NEW_LWP|THR_JOINABLE); - - /// The destructor - virtual ~TAO_Pool_Per_Endpoint (void); - - /// Run all the threads and wait until they finish - void run (CORBA::Environment &ACE_TRY_ENV = - TAO_default_environment ()); - - // = The Task_Base entry point - int svc (void); - -private: - /// The ORB. - CORBA::ORB_var orb_; - - /// The scheduling policy to activate the threads. - int policy_; - - /// The number of threads on each pool. - int poolsize_; - - /// The flags used to create the threads - int flags_; - - /// The thread manager. - ACE_Thread_Manager thread_manager_; -}; - -#if defined (__ACE_INLINE__) -# include "Pool_Per_Endpoint.i" -#endif /* __ACE_INLINE__ */ - -#include "ace/post.h" -#endif /* TAO_POOL_PER_ENDPOINT_H */ diff --git a/TAO/tao/RTCORBA/Pool_Per_Endpoint.i b/TAO/tao/RTCORBA/Pool_Per_Endpoint.i deleted file mode 100644 index cfa1da318d3..00000000000 --- a/TAO/tao/RTCORBA/Pool_Per_Endpoint.i +++ /dev/null @@ -1 +0,0 @@ -// $Id$ diff --git a/TAO/tao/RTCORBA/TAO_RTCORBA.dsp b/TAO/tao/RTCORBA/TAO_RTCORBA.dsp index 6d4d499d2f1..279079d61e1 100644 --- a/TAO/tao/RTCORBA/TAO_RTCORBA.dsp +++ b/TAO/tao/RTCORBA/TAO_RTCORBA.dsp @@ -164,10 +164,6 @@ SOURCE=.\Linear_Priority_Mapping.cpp # End Source File
# Begin Source File
-SOURCE=.\Pool_Per_Endpoint.cpp
-# End Source File
-# Begin Source File
-
SOURCE=.\Priority_Mapping.cpp
# End Source File
# Begin Source File
@@ -260,10 +256,6 @@ SOURCE=.\Linear_Priority_Mapping.h # End Source File
# Begin Source File
-SOURCE=.\Pool_Per_Endpoint.h
-# End Source File
-# Begin Source File
-
SOURCE=.\Priority_Mapping.h
# End Source File
# Begin Source File
@@ -360,10 +352,6 @@ SOURCE=.\Linear_Priority_Mapping.i # End Source File
# Begin Source File
-SOURCE=.\Pool_Per_Endpoint.i
-# End Source File
-# Begin Source File
-
SOURCE=.\Priority_Mapping.i
# End Source File
# Begin Source File
diff --git a/TAO/tao/RTCORBA/Thread_Pool.cpp b/TAO/tao/RTCORBA/Thread_Pool.cpp index f9af3801b07..3b10759666f 100644 --- a/TAO/tao/RTCORBA/Thread_Pool.cpp +++ b/TAO/tao/RTCORBA/Thread_Pool.cpp @@ -10,6 +10,7 @@ ACE_RCSID(tao, Thread_Pool, "$Id$") #include "tao/Acceptor_Registry.h" #include "tao/Transport_Cache_Manager.h" #include "tao/debug.h" +#include "tao/RTCORBA/Priority_Mapping_Manager.h" #if !defined (__ACE_INLINE__) # include "Thread_Pool.i" @@ -78,13 +79,55 @@ TAO_Thread_Lane::TAO_Thread_Lane (TAO_Thread_Pool &pool, static_threads_ (static_threads), dynamic_threads_ (dynamic_threads), threads_ (*this), - resources_ (pool.manager ().orb_core ()) + resources_ (pool.manager ().orb_core ()), + native_priority_ (TAO_INVALID_PRIORITY) { } void +TAO_Thread_Lane::validate_and_map_priority (CORBA::Environment &ACE_TRY_ENV) +{ + // Check that the priority is in bounds. + if (this->lane_priority_ < RTCORBA::minPriority || + this->lane_priority_ > RTCORBA::maxPriority) + ACE_THROW (CORBA::DATA_CONVERSION ()); + + CORBA::ORB_ptr orb = + this->pool_.manager ().orb_core ().orb (); + + CORBA::Object_var obj = + orb->resolve_initial_references (TAO_OBJID_PRIORITYMAPPINGMANAGER, + ACE_TRY_ENV); + ACE_CHECK; + + TAO_Priority_Mapping_Manager_var mapping_manager = + TAO_Priority_Mapping_Manager::_narrow (obj.in (), + ACE_TRY_ENV); + ACE_CHECK; + + RTCORBA::PriorityMapping *pm = + mapping_manager.in ()->mapping (); + + CORBA::Boolean result = + pm->to_native (this->lane_priority_, this->native_priority_); + + if (!result) + ACE_THROW (CORBA::DATA_CONVERSION ()); + + if (TAO_debug_level > 3) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) - creating thread at ") + ACE_TEXT ("(corba:native) priority %d:%d\n"), + this->lane_priority_, + this->native_priority_)); +} + +void TAO_Thread_Lane::open (CORBA::Environment &ACE_TRY_ENV) { + this->validate_and_map_priority (ACE_TRY_ENV); + ACE_CHECK; + int result = 0; result = this->resources_.open_acceptor_registry (ACE_TRY_ENV); @@ -148,7 +191,7 @@ TAO_Thread_Lane::create_dynamic_threads (CORBA::ULong number_of_threads) return this->threads_.activate (default_flags, number_of_threads, force_active, - this->lane_priority_, + this->native_priority_, default_grp_id, default_task, default_thread_handles, diff --git a/TAO/tao/RTCORBA/Thread_Pool.h b/TAO/tao/RTCORBA/Thread_Pool.h index 578d592c083..c7441a5b26f 100644 --- a/TAO/tao/RTCORBA/Thread_Pool.h +++ b/TAO/tao/RTCORBA/Thread_Pool.h @@ -111,6 +111,9 @@ public: private: + /// Validate the lane's priority and map priority it to a native value. + void validate_and_map_priority (CORBA::Environment &ACE_TRY_ENV); + TAO_Thread_Pool &pool_; CORBA::ULong id_; @@ -121,6 +124,8 @@ private: TAO_Thread_Pool_Threads threads_; TAO_Thread_Lane_Resources resources_; + + CORBA::Short native_priority_; }; class TAO_Thread_Pool_Manager; diff --git a/TAO/tao/RTPortableServer/RT_Acceptor_Filters.cpp b/TAO/tao/RTPortableServer/RT_Acceptor_Filters.cpp index 76ebf35a09e..4df386ee644 100644 --- a/TAO/tao/RTPortableServer/RT_Acceptor_Filters.cpp +++ b/TAO/tao/RTPortableServer/RT_Acceptor_Filters.cpp @@ -17,11 +17,11 @@ TAO_Server_Protocol_Acceptor_Filter (RTCORBA::ProtocolList &protocols) } int -TAO_Server_Protocol_Acceptor_Filter:: -fill_mprofile (const TAO_ObjectKey &object_key, - TAO_MProfile &mprofile, - TAO_Acceptor **acceptors_begin, - TAO_Acceptor **acceptors_end) +TAO_Server_Protocol_Acceptor_Filter::fill_profile (const TAO_ObjectKey &object_key, + TAO_MProfile &mprofile, + TAO_Acceptor **acceptors_begin, + TAO_Acceptor **acceptors_end, + CORBA::Short priority) { // RTCORBA 1.0, Section 4.15.1: ServerProtocolPolicy determines // which protocols get included into IOR and in what order. @@ -32,12 +32,10 @@ fill_mprofile (const TAO_ObjectKey &object_key, for (TAO_Acceptor** acceptor = acceptors_begin; acceptor != acceptors_end; ++acceptor) - if ((*acceptor)->tag () == protocol_type - && this->validate_acceptor (*acceptor) - && ((*acceptor)->create_mprofile (object_key, - mprofile, - 1 /* >=1 endpoints per profile */) - == -1)) + if ((*acceptor)->tag () == protocol_type && + ((*acceptor)->create_profile (object_key, + mprofile, + priority) == -1)) return -1; } @@ -45,8 +43,7 @@ fill_mprofile (const TAO_ObjectKey &object_key, } int -TAO_Server_Protocol_Acceptor_Filter:: -encode_endpoints (TAO_MProfile &mprofile) +TAO_Server_Protocol_Acceptor_Filter::encode_endpoints (TAO_MProfile &mprofile) { // Encode endpoints. for (CORBA::ULong i = 0; @@ -60,9 +57,3 @@ encode_endpoints (TAO_MProfile &mprofile) return 0; } -int -TAO_Server_Protocol_Acceptor_Filter:: -validate_acceptor (TAO_Acceptor * /*acceptor*/) -{ - return 1; -} diff --git a/TAO/tao/RTPortableServer/RT_Acceptor_Filters.h b/TAO/tao/RTPortableServer/RT_Acceptor_Filters.h index 2d5aaeda2c5..48377781668 100644 --- a/TAO/tao/RTPortableServer/RT_Acceptor_Filters.h +++ b/TAO/tao/RTPortableServer/RT_Acceptor_Filters.h @@ -56,23 +56,16 @@ public: TAO_Server_Protocol_Acceptor_Filter (RTCORBA::ProtocolList &protocols); /// Populate <mprofile> based on what's in <protocols_>. - int fill_mprofile (const TAO_ObjectKey &object_key, - TAO_MProfile &mprofile, - TAO_Acceptor **acceptors_begin, - TAO_Acceptor **acceptors_end); + int fill_profile (const TAO_ObjectKey &object_key, + TAO_MProfile &mprofile, + TAO_Acceptor **acceptors_begin, + TAO_Acceptor **acceptors_end, + CORBA::Short priority); /// Encodes the endpoints in the profiles into the TAO_TAG_ENDPOINTS /// tag component of profiles. int encode_endpoints (TAO_MProfile &mprofile); - virtual int validate_acceptor (TAO_Acceptor *acceptor); - // Template method pattern. This method is used by <fill_mprofile> - // to decide whether <acceptor> endpoint should be added to - // mprofile or not. Returns true or false. - // This implementation always returns true. Subclasses can override - // to specify additional conditions that must be met by an - // <acceptor> for inclusion into mprofile. - private: RTCORBA::ProtocolList &protocols_; // Value of the ServerProtocolPolicy used for endpoint diff --git a/TAO/tao/RTPortableServer/RT_POA.cpp b/TAO/tao/RTPortableServer/RT_POA.cpp index e4a0bb793c9..d8323c2007e 100644 --- a/TAO/tao/RTPortableServer/RT_POA.cpp +++ b/TAO/tao/RTPortableServer/RT_POA.cpp @@ -109,15 +109,15 @@ TAO_RT_POA::parse_rt_policies (TAO_POA_Policy_Set &policies, ACE_CHECK; this->cached_policies ().priority_model ( - TAO_POA_Cached_Policies::PriorityModel ( - rt_priority_model)); + TAO_POA_Cached_Policies::PriorityModel ( + rt_priority_model)); RTCORBA::Priority priority = priority_model->server_priority (ACE_TRY_ENV); - ACE_CHECK; + ACE_CHECK; - this->cached_policies ().server_priority (priority); - } + this->cached_policies ().server_priority (priority); + } } this->thread_pool_ = @@ -128,9 +128,13 @@ TAO_RT_POA::parse_rt_policies (TAO_POA_Policy_Set &policies, } void -TAO_RT_POA::valid_priority (RTCORBA::Priority priority, - CORBA_Environment &ACE_TRY_ENV) +TAO_RT_POA::validate_priority (RTCORBA::Priority priority, + CORBA_Environment &ACE_TRY_ENV) { + if (priority < RTCORBA::minPriority || + priority > RTCORBA::maxPriority) + ACE_THROW (CORBA::BAD_PARAM ()); + // If this POA is using a thread pool with lanes, make sure the // priority matches one of the thread lanes. if (this->thread_pool_ != 0 && @@ -161,7 +165,7 @@ TAO_RT_POA::validate_policies (CORBA::Environment &ACE_TRY_ENV) // priority from "somewhere" when a request arrives for an inactive // object. if (this->cached_policies_.implicit_activation () == - PortableServer::IMPLICIT_ACTIVATION) + PortableServer::IMPLICIT_ACTIVATION) { ACE_THROW (PortableServer::POA::WrongPolicy ()); } @@ -170,7 +174,7 @@ TAO_RT_POA::validate_policies (CORBA::Environment &ACE_TRY_ENV) // SERVER_DECLARED option for the PriorityModelPolicy then the ORB // shall raise a WrongPolicy user exception. if (this->cached_policies_.priority_model () != - TAO_POA_Cached_Policies::SERVER_DECLARED) + TAO_POA_Cached_Policies::SERVER_DECLARED) { ACE_THROW (PortableServer::POA::WrongPolicy ()); } @@ -320,10 +324,11 @@ TAO_RT_POA::create_stub_object (const TAO_ObjectKey &object_key, lanes[i]->resources ().acceptor_registry (); result = - filter->fill_mprofile (object_key, - mprofile, - acceptor_registry.begin (), - acceptor_registry.end ()); + filter->fill_profile (object_key, + mprofile, + acceptor_registry.begin (), + acceptor_registry.end (), + lanes[i]->lane_priority ()); if (result == -1) error = 1; } @@ -486,8 +491,8 @@ TAO_RT_POA::find_POA (const char *adapter_name, void TAO_RT_POA::destroy (CORBA::Boolean etherealize_objects, - CORBA::Boolean wait_for_completion, - CORBA_Environment &ACE_TRY_ENV) + CORBA::Boolean wait_for_completion, + CORBA_Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { this->TAO_POA::destroy (etherealize_objects, @@ -501,7 +506,7 @@ TAO_RT_POA::destroy (CORBA::Boolean etherealize_objects, PortableServer::ThreadPolicy_ptr TAO_RT_POA::create_thread_policy (PortableServer::ThreadPolicyValue value, - CORBA_Environment &ACE_TRY_ENV) + CORBA_Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { PortableServer::ThreadPolicy_ptr policy = @@ -515,7 +520,7 @@ TAO_RT_POA::create_thread_policy (PortableServer::ThreadPolicyValue value, PortableServer::LifespanPolicy_ptr TAO_RT_POA::create_lifespan_policy (PortableServer::LifespanPolicyValue value, - CORBA_Environment &ACE_TRY_ENV) + CORBA_Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { PortableServer::LifespanPolicy_ptr policy = @@ -527,7 +532,7 @@ TAO_RT_POA::create_lifespan_policy (PortableServer::LifespanPolicyValue value, PortableServer::IdUniquenessPolicy_ptr TAO_RT_POA::create_id_uniqueness_policy (PortableServer::IdUniquenessPolicyValue value, - CORBA_Environment &ACE_TRY_ENV) + CORBA_Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { PortableServer::IdUniquenessPolicy_ptr policy = @@ -540,12 +545,12 @@ TAO_RT_POA::create_id_uniqueness_policy (PortableServer::IdUniquenessPolicyValue PortableServer::IdAssignmentPolicy_ptr TAO_RT_POA::create_id_assignment_policy (PortableServer::IdAssignmentPolicyValue value, - CORBA_Environment &ACE_TRY_ENV) + CORBA_Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { PortableServer::IdAssignmentPolicy_ptr policy = this->TAO_POA::create_id_assignment_policy (value, - ACE_TRY_ENV); + ACE_TRY_ENV); ACE_CHECK_RETURN (policy); return policy; } @@ -555,7 +560,7 @@ TAO_RT_POA::create_id_assignment_policy (PortableServer::IdAssignmentPolicyValue PortableServer::ImplicitActivationPolicy_ptr TAO_RT_POA::create_implicit_activation_policy (PortableServer::ImplicitActivationPolicyValue value, - CORBA_Environment &ACE_TRY_ENV) + CORBA_Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { PortableServer::ImplicitActivationPolicy_ptr policy = @@ -567,7 +572,7 @@ TAO_RT_POA::create_implicit_activation_policy (PortableServer::ImplicitActivatio PortableServer::ServantRetentionPolicy_ptr TAO_RT_POA::create_servant_retention_policy (PortableServer::ServantRetentionPolicyValue value, - CORBA_Environment &ACE_TRY_ENV) + CORBA_Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { PortableServer::ServantRetentionPolicy_ptr policy = @@ -580,7 +585,7 @@ TAO_RT_POA::create_servant_retention_policy (PortableServer::ServantRetentionPol PortableServer::RequestProcessingPolicy_ptr TAO_RT_POA::create_request_processing_policy (PortableServer::RequestProcessingPolicyValue value, - CORBA_Environment &ACE_TRY_ENV) + CORBA_Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { PortableServer::RequestProcessingPolicy_ptr policy = @@ -648,7 +653,7 @@ TAO_RT_POA::the_activator (CORBA_Environment &ACE_TRY_ENV) void TAO_RT_POA::the_activator (PortableServer::AdapterActivator_ptr adapter_activator, - CORBA_Environment &ACE_TRY_ENV) + CORBA_Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { this->TAO_POA::the_activator (adapter_activator, @@ -669,7 +674,7 @@ TAO_RT_POA::get_servant_manager (CORBA_Environment &ACE_TRY_ENV) void TAO_RT_POA::set_servant_manager (PortableServer::ServantManager_ptr imgr, - CORBA_Environment &ACE_TRY_ENV) + CORBA_Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException, PortableServer::POA::WrongPolicy)) { @@ -692,7 +697,7 @@ TAO_RT_POA::get_servant (CORBA_Environment &ACE_TRY_ENV) void TAO_RT_POA::set_servant (PortableServer::Servant servant, - CORBA_Environment &ACE_TRY_ENV) + CORBA_Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException, PortableServer::POA::WrongPolicy)) { @@ -705,7 +710,7 @@ TAO_RT_POA::set_servant (PortableServer::Servant servant, PortableServer::ObjectId * TAO_RT_POA::activate_object (PortableServer::Servant p_servant, - CORBA_Environment &ACE_TRY_ENV) + CORBA_Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException, PortableServer::POA::ServantAlreadyActive, PortableServer::POA::WrongPolicy)) @@ -719,8 +724,8 @@ TAO_RT_POA::activate_object (PortableServer::Servant p_servant, void TAO_RT_POA::activate_object_with_id (const PortableServer::ObjectId &id, - PortableServer::Servant p_servant, - CORBA_Environment &ACE_TRY_ENV) + PortableServer::Servant p_servant, + CORBA_Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException, PortableServer::POA::ServantAlreadyActive, PortableServer::POA::ObjectAlreadyActive, @@ -734,7 +739,7 @@ TAO_RT_POA::activate_object_with_id (const PortableServer::ObjectId &id, void TAO_RT_POA::deactivate_object (const PortableServer::ObjectId &oid, - CORBA_Environment &ACE_TRY_ENV) + CORBA_Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException, PortableServer::POA::ObjectNotActive, PortableServer::POA::WrongPolicy)) @@ -746,7 +751,7 @@ TAO_RT_POA::deactivate_object (const PortableServer::ObjectId &oid, CORBA::Object_ptr TAO_RT_POA::create_reference (const char *intf, - CORBA_Environment &ACE_TRY_ENV) + CORBA_Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException, PortableServer::POA::WrongPolicy)) { @@ -759,8 +764,8 @@ TAO_RT_POA::create_reference (const char *intf, CORBA::Object_ptr TAO_RT_POA::create_reference_with_id (const PortableServer::ObjectId &oid, - const char *intf, - CORBA_Environment &ACE_TRY_ENV) + const char *intf, + CORBA_Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException, PortableServer::POA::WrongPolicy)) { @@ -774,7 +779,7 @@ TAO_RT_POA::create_reference_with_id (const PortableServer::ObjectId &oid, PortableServer::ObjectId * TAO_RT_POA::servant_to_id (PortableServer::Servant p_servant, - CORBA_Environment &ACE_TRY_ENV) + CORBA_Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException, PortableServer::POA::ServantNotActive, PortableServer::POA::WrongPolicy)) @@ -788,7 +793,7 @@ TAO_RT_POA::servant_to_id (PortableServer::Servant p_servant, CORBA::Object_ptr TAO_RT_POA::servant_to_reference (PortableServer::Servant p_servant, - CORBA_Environment &ACE_TRY_ENV) + CORBA_Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException, PortableServer::POA::ServantNotActive, PortableServer::POA::WrongPolicy)) @@ -803,7 +808,7 @@ TAO_RT_POA::servant_to_reference (PortableServer::Servant p_servant, PortableServer::Servant TAO_RT_POA::reference_to_servant (CORBA::Object_ptr reference, - CORBA_Environment &ACE_TRY_ENV) + CORBA_Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException, PortableServer::POA::ObjectNotActive, PortableServer::POA::WrongAdapter, @@ -818,7 +823,7 @@ TAO_RT_POA::reference_to_servant (CORBA::Object_ptr reference, PortableServer::ObjectId * TAO_RT_POA::reference_to_id (CORBA::Object_ptr reference, - CORBA_Environment &ACE_TRY_ENV) + CORBA_Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException, PortableServer::POA::WrongAdapter, PortableServer::POA::WrongPolicy)) @@ -832,7 +837,7 @@ TAO_RT_POA::reference_to_id (CORBA::Object_ptr reference, PortableServer::Servant TAO_RT_POA::id_to_servant (const PortableServer::ObjectId &oid, - CORBA_Environment &ACE_TRY_ENV) + CORBA_Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException, PortableServer::POA::ObjectNotActive, PortableServer::POA::WrongPolicy)) @@ -846,7 +851,7 @@ TAO_RT_POA::id_to_servant (const PortableServer::ObjectId &oid, CORBA::Object_ptr TAO_RT_POA::id_to_reference (const PortableServer::ObjectId &oid, - CORBA_Environment &ACE_TRY_ENV) + CORBA_Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException, PortableServer::POA::ObjectNotActive, PortableServer::POA::WrongPolicy)) diff --git a/TAO/tao/RTPortableServer/RT_POA.h b/TAO/tao/RTPortableServer/RT_POA.h index d6da1873ebf..befde6060d5 100644 --- a/TAO/tao/RTPortableServer/RT_POA.h +++ b/TAO/tao/RTPortableServer/RT_POA.h @@ -266,6 +266,8 @@ public: virtual ~TAO_RT_POA (void); + void *thread_pool (void) const; + protected: /// Template method for creating new POA's of this type. @@ -284,8 +286,8 @@ protected: CORBA::Short priority, CORBA_Environment &ACE_TRY_ENV); - void valid_priority (RTCORBA::Priority priority, - CORBA_Environment &ACE_TRY_ENV); + void validate_priority (RTCORBA::Priority priority, + CORBA_Environment &ACE_TRY_ENV); void validate_policies (CORBA::Environment &ACE_TRY_ENV); diff --git a/TAO/tao/RTPortableServer/RT_POA.i b/TAO/tao/RTPortableServer/RT_POA.i index c45f4cd0db7..71c05db66dc 100644 --- a/TAO/tao/RTPortableServer/RT_POA.i +++ b/TAO/tao/RTPortableServer/RT_POA.i @@ -6,8 +6,8 @@ ACE_INLINE CORBA::Object_ptr TAO_RT_POA::create_reference_with_priority (const char * intf, - RTCORBA::Priority priority, - CORBA::Environment &ACE_TRY_ENV) + RTCORBA::Priority priority, + CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException, PortableServer::POA::WrongPolicy)) { @@ -15,7 +15,7 @@ TAO_RT_POA::create_reference_with_priority (const char * intf, this->validate_policies (ACE_TRY_ENV); ACE_CHECK_RETURN (CORBA::Object::_nil ()); - this->valid_priority (priority, ACE_TRY_ENV); + this->validate_priority (priority, ACE_TRY_ENV); ACE_CHECK_RETURN (CORBA::Object::_nil ()); // Lock access for the duration of this transaction. @@ -28,9 +28,9 @@ TAO_RT_POA::create_reference_with_priority (const char * intf, ACE_INLINE CORBA::Object_ptr TAO_RT_POA::create_reference_with_id_and_priority (const PortableServer::ObjectId & oid, - const char * intf, - RTCORBA::Priority priority, - CORBA::Environment &ACE_TRY_ENV) + const char * intf, + RTCORBA::Priority priority, + CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException, PortableServer::POA::WrongPolicy)) { @@ -38,7 +38,7 @@ TAO_RT_POA::create_reference_with_id_and_priority (const PortableServer::ObjectI this->validate_policies (ACE_TRY_ENV); ACE_CHECK_RETURN (CORBA::Object::_nil ()); - this->valid_priority (priority, ACE_TRY_ENV); + this->validate_priority (priority, ACE_TRY_ENV); ACE_CHECK_RETURN (CORBA::Object::_nil ()); // Lock access for the duration of this transaction. @@ -52,8 +52,8 @@ TAO_RT_POA::create_reference_with_id_and_priority (const PortableServer::ObjectI ACE_INLINE PortableServer::ObjectId * TAO_RT_POA::activate_object_with_priority (PortableServer::Servant servant, - RTCORBA::Priority priority, - CORBA::Environment &ACE_TRY_ENV) + RTCORBA::Priority priority, + CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException, PortableServer::POA::ServantAlreadyActive, PortableServer::POA::WrongPolicy)) @@ -62,7 +62,7 @@ TAO_RT_POA::activate_object_with_priority (PortableServer::Servant servant, this->validate_policies (ACE_TRY_ENV); ACE_CHECK_RETURN (0); - this->valid_priority (priority, ACE_TRY_ENV); + this->validate_priority (priority, ACE_TRY_ENV); ACE_CHECK_RETURN (0); // Lock access for the duration of this transaction. @@ -75,9 +75,9 @@ TAO_RT_POA::activate_object_with_priority (PortableServer::Servant servant, ACE_INLINE void TAO_RT_POA::activate_object_with_id_and_priority (const PortableServer::ObjectId & oid, - PortableServer::Servant servant, - RTCORBA::Priority priority, - CORBA::Environment &ACE_TRY_ENV) + PortableServer::Servant servant, + RTCORBA::Priority priority, + CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException, PortableServer::POA::ServantAlreadyActive, PortableServer::POA::ObjectAlreadyActive, @@ -87,7 +87,7 @@ TAO_RT_POA::activate_object_with_id_and_priority (const PortableServer::ObjectId this->validate_policies (ACE_TRY_ENV); ACE_CHECK; - this->valid_priority (priority, ACE_TRY_ENV); + this->validate_priority (priority, ACE_TRY_ENV); ACE_CHECK; // Lock access for the duration of this transaction. @@ -99,3 +99,8 @@ TAO_RT_POA::activate_object_with_id_and_priority (const PortableServer::ObjectId ACE_TRY_ENV); } +ACE_INLINE void * +TAO_RT_POA::thread_pool (void) const +{ + return this->thread_pool_; +} diff --git a/TAO/tao/RTPortableServer/RT_Policy_Validator.cpp b/TAO/tao/RTPortableServer/RT_Policy_Validator.cpp index 422fb586e01..181e8927bb8 100644 --- a/TAO/tao/RTPortableServer/RT_Policy_Validator.cpp +++ b/TAO/tao/RTPortableServer/RT_Policy_Validator.cpp @@ -130,8 +130,8 @@ TAO_POA_RT_Policy_Validator::validate_priorities (TAO_Policy_Set &policies, ACE_CHECK; // Check that the priority is in bounds. - if (priority < RTCORBA::minPriority - || priority > RTCORBA::maxPriority) + if (priority < RTCORBA::minPriority || + priority > RTCORBA::maxPriority) ACE_THROW (PortableServer::POA::InvalidPolicy ()); } @@ -149,9 +149,12 @@ TAO_POA_RT_Policy_Validator::validate_priorities (TAO_Policy_Set &policies, // If priority banded connections are set, make sure that: // 1. There is at least one band. - // 2. If priority model is SERVER_DECLARED, server_priority must + // 2a. low is not < RTCORBA::minPriority + // 2b. low <= high + // 2c. high is not > RTCORBA::maxPriority + // 3. If priority model is SERVER_DECLARED, server_priority must // match one of the bands. - // 3. If this POA has a thread pool with lanes, then for each band, + // 4. If this POA has a thread pool with lanes, then for each band, // there must be at least one thread lane that can service it, // i.e., whose priority falls into the band's range. if (bands_policy != 0) @@ -163,7 +166,19 @@ TAO_POA_RT_Policy_Validator::validate_priorities (TAO_Policy_Set &policies, if (bands.length () == 0) ACE_THROW (PortableServer::POA::InvalidPolicy ()); - // Check 2. + // Checks 2. + for (CORBA::ULong i = 0; i < bands.length (); ++i) + { + // 2a. low is not < RTCORBA::minPriority + // 2b. low is not > high + // 2c. high is not > RTCORBA::maxPriority + if (bands[i].low < RTCORBA::minPriority || + bands[i].low > bands[i].high || + bands[i].high > RTCORBA::maxPriority) + ACE_THROW (PortableServer::POA::InvalidPolicy ()); + } + + // Check 3. if (rt_priority_model == RTCORBA::SERVER_DECLARED) { int match = 0; @@ -182,7 +197,7 @@ TAO_POA_RT_Policy_Validator::validate_priorities (TAO_Policy_Set &policies, } // - // Check 3. + // Check 4. // // If this POA is using the default thread pool (which doesn't diff --git a/TAO/tao/RTPortableServer/RT_Servant_Dispatcher.cpp b/TAO/tao/RTPortableServer/RT_Servant_Dispatcher.cpp index 3446163b628..b7bb51f6879 100644 --- a/TAO/tao/RTPortableServer/RT_Servant_Dispatcher.cpp +++ b/TAO/tao/RTPortableServer/RT_Servant_Dispatcher.cpp @@ -2,6 +2,7 @@ #include "RT_Servant_Dispatcher.h" #include "RT_POA.h" +#include "tao/RTCORBA/Thread_Pool.h" #include "tao/ORB_Core.h" #include "tao/TAO_Server_Request.h" #include "tao/Service_Context.h" @@ -9,34 +10,33 @@ ACE_RCSID(tao, Default_Acceptor_Filter, "$Id$") -RT_Priority_Model_Processing::RT_Priority_Model_Processing (TAO_POA &poa) +RT_Priority_Model_Processing::RT_Priority_Model_Processing (TAO_POA &poa, + CORBA::Short servant_priority) : state_ (NO_ACTION_REQUIRED), poa_ (poa), - original_priority_ (0) + servant_priority_ (servant_priority), + original_priority_ (TAO_INVALID_PRIORITY) { } RT_Priority_Model_Processing::~RT_Priority_Model_Processing (void) { - ACE_DECLARE_NEW_CORBA_ENV; - if (this->state_ == PRIORITY_RESET_REQUIRED) { - this->state_ = NO_ACTION_REQUIRED; - - // Reset the priority of the current thread back to its original - // value. - TAO_Protocols_Hooks *tph = poa_.orb_core ().get_protocols_hooks (ACE_TRY_ENV); - ACE_CHECK; + ACE_DECLARE_NEW_CORBA_ENV; - if (tph->set_thread_priority (this->original_priority_, - ACE_TRY_ENV) - == -1) - // At this point we cannot throw an exception. Just log the - // error. - ACE_DEBUG ((LM_ERROR, - ACE_TEXT ("TAO (%P|%t) - Priority_Model_Processing:: ") - ACE_TEXT (" Priority_Model_Processing\n"))); + ACE_TRY + { + this->post_invoke (ACE_TRY_ENV); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + // Eat up the exception. + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Exception caught: TAO (%P|%t) - Priority_Model_Processing::~Priority_Model_Processing"); + } + ACE_ENDTRY; } } @@ -46,25 +46,61 @@ RT_Priority_Model_Processing::pre_invoke ( TAO_Service_Context &reply_service_context, CORBA::Environment &ACE_TRY_ENV) { - TAO_POA_Cached_Policies &cached_policies = this->poa_.cached_policies (); + TAO_Thread_Pool *thread_pool = + (TAO_Thread_Pool *) this->poa_.thread_pool (); - // CLIENT_PROPAGATED PriorityModel processing. - if (cached_policies.priority_model () == TAO_POA_Cached_Policies::CLIENT_PROPAGATED - && cached_policies.server_priority () != TAO_INVALID_PRIORITY) + if (thread_pool != 0 && + thread_pool->with_lanes ()) { - // Remember current thread's priority. - TAO_Protocols_Hooks *tph = poa_.orb_core ().get_protocols_hooks (ACE_TRY_ENV); - ACE_CHECK; + // We don't mess with the priority of threads in lanes. - if (tph->get_thread_priority (this->original_priority_, - ACE_TRY_ENV) - == -1) - ACE_THROW (CORBA::DATA_CONVERSION (1, - CORBA::COMPLETED_NO)); + if (TAO_debug_level > 0) + { + // Get the ORB_Core's TSS resources. + TAO_ORB_Core_TSS_Resources *tss = + this->poa_.orb_core ().get_tss_resources (); + + /// Get the lane attribute in TSS. + TAO_Thread_Lane *lane = + (TAO_Thread_Lane *) tss->lane_; + + ACE_ASSERT (lane->pool ().id () == + thread_pool->id ()); + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Using thread pool with lane ") + ACE_TEXT ("(%P|%t|%d|%d): original thread priority not changed\n"), + lane->pool ().id (), + lane->id ())); + } + + return; + } + + // Remember current thread's priority. + TAO_Protocols_Hooks *tph = + this->poa_.orb_core ().get_protocols_hooks (ACE_TRY_ENV); + ACE_CHECK; + + if (tph->get_thread_priority (this->original_priority_, + ACE_TRY_ENV) + == -1) + ACE_THROW (CORBA::DATA_CONVERSION (1, + CORBA::COMPLETED_NO)); + + int client_propagated = 0; + RTCORBA::Priority target_priority = TAO_INVALID_PRIORITY; + TAO_POA_Cached_Policies &cached_policies = + this->poa_.cached_policies (); + + // CLIENT_PROPAGATED PriorityModel processing. + if (cached_policies.priority_model () == + TAO_POA_Cached_Policies::CLIENT_PROPAGATED) + { + client_propagated = 1; // Attempt to extract client-propagated priority from the - // ServiceContextList of the request. - RTCORBA::Priority target_priority; + // ServiceContextList of the request. const IOP::ServiceContext *context; if (request_service_context.get_context (IOP::RTCorbaPriority, @@ -90,37 +126,54 @@ RT_Priority_Model_Processing::pre_invoke ( } else { - // Use default priority if none came in the request. (Request - // must have come from a non-RT ORB.) + // Use default priority if none came in the request. + // (Request must have come from a non-RT ORB.) target_priority = cached_policies.server_priority (); } + } + else + // SERVER_DECLARED PriorityModel processing. + { + // Use the request associated with the servant. + target_priority = this->servant_priority_; + } + + const char *priority_model; + if (client_propagated) + priority_model = "RTCORBA::CLIENT_PROPAGATED"; + else + priority_model = "RTCORBA::SERVER_DECLARED"; - // Change the priority of the current thread to the - // client-propagated value for the duration of - // request. - if (original_priority_ != target_priority) + // Change the priority of the current thread for the duration of + // request. + if (target_priority != TAO_INVALID_PRIORITY && + target_priority != this->original_priority_) + { + if (TAO_debug_level > 0) { - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("RTCORBA::CLIENT_PROPAGATED processing") - ACE_TEXT (" (%P|%t): original thread priority %d") - ACE_TEXT (" temporarily changed to %d\n"), - original_priority_, target_priority)); - - if (tph->set_thread_priority (target_priority, - ACE_TRY_ENV) - == -1) - ACE_THROW (CORBA::DATA_CONVERSION (1, CORBA::COMPLETED_NO)); - - this->state_ = PRIORITY_RESET_REQUIRED; + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%s processing ") + ACE_TEXT ("(%P|%t): original thread priority %d ") + ACE_TEXT ("temporarily changed to %d\n"), + priority_model, + original_priority_, + target_priority)); } - else if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("RTCORBA::CLIENT_PROPAGATED processing") - ACE_TEXT (" (%P|%t): original thread priority =") - ACE_TEXT (" requested priority = %d\n"), - target_priority)); + + if (tph->set_thread_priority (target_priority, + ACE_TRY_ENV) + == -1) + ACE_THROW (CORBA::DATA_CONVERSION (1, CORBA::COMPLETED_NO)); + + this->state_ = PRIORITY_RESET_REQUIRED; } + else if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%s processing ") + ACE_TEXT ("(%P|%t): original thread priority = ") + ACE_TEXT ("target priority = %d\n"), + priority_model, + target_priority)); } void @@ -133,7 +186,8 @@ RT_Priority_Model_Processing::post_invoke ( // Reset the priority of the current thread back to its original // value. - TAO_Protocols_Hooks *tph = poa_.orb_core ().get_protocols_hooks (ACE_TRY_ENV); + TAO_Protocols_Hooks *tph = + this->poa_.orb_core ().get_protocols_hooks (ACE_TRY_ENV); ACE_CHECK; if (tph->set_thread_priority (this->original_priority_, @@ -155,11 +209,11 @@ TAO_RT_Servant_Dispatcher::dispatch (TAO_Object_Adapter::Servant_Upcall &servant CORBA::Environment &ACE_TRY_ENV) { // RTCORBA PriorityModelPolicy processing (may need to be - // moved/adjusted when POA threadpools are added). - // This is the earliest place we can do the processing, since only - // at this point we know the target POA. - - RT_Priority_Model_Processing priority_processing (servant_upcall.poa ()); + // moved/adjusted when POA threadpools are added). This is the + // earliest place we can do the processing, since only at this point + // we know the target POA. + RT_Priority_Model_Processing priority_processing (servant_upcall.poa (), + servant_upcall.priority ()); // Set thread's priority. priority_processing.pre_invoke (req.request_service_context (), @@ -208,4 +262,3 @@ TAO_RT_Servant_Dispatcher::create_POA (const ACE_CString &name, return poa; } - diff --git a/TAO/tao/RTPortableServer/RT_Servant_Dispatcher.h b/TAO/tao/RTPortableServer/RT_Servant_Dispatcher.h index 874f407af5b..e6d1f8c7be0 100644 --- a/TAO/tao/RTPortableServer/RT_Servant_Dispatcher.h +++ b/TAO/tao/RTPortableServer/RT_Servant_Dispatcher.h @@ -76,7 +76,8 @@ class TAO_RTPortableServer_Export RT_Priority_Model_Processing public: // Constructor. - RT_Priority_Model_Processing (TAO_POA &poa); + RT_Priority_Model_Processing (TAO_POA &poa, + CORBA::Short servant_priority); // Resets the priority of the current thread back to its original // value if necessary, i.e., if it was changed and the @@ -114,6 +115,9 @@ private: // Poa of the target servant. TAO_POA &poa_; + // Servant Priority. + CORBA::Short servant_priority_; + // Original priority of the thread. RTCORBA::Priority original_priority_; }; diff --git a/TAO/tao/Strategies/SHMIOP_Acceptor.cpp b/TAO/tao/Strategies/SHMIOP_Acceptor.cpp index 898a2561217..36b02bc47eb 100644 --- a/TAO/tao/Strategies/SHMIOP_Acceptor.cpp +++ b/TAO/tao/Strategies/SHMIOP_Acceptor.cpp @@ -74,23 +74,26 @@ TAO_SHMIOP_Acceptor::~TAO_SHMIOP_Acceptor (void) // interfaces over which we can receive requests. Thus a profile // must be made for each one. int -TAO_SHMIOP_Acceptor::create_mprofile (const TAO_ObjectKey &object_key, - TAO_MProfile &mprofile, - CORBA::Boolean share_profile) +TAO_SHMIOP_Acceptor::create_profile (const TAO_ObjectKey &object_key, + TAO_MProfile &mprofile, + CORBA::Short priority) { // Check if multiple endpoints should be put in one profile or // if they should be spread across multiple profiles. - if (share_profile == 1) - return this->create_shared_profile (object_key, - mprofile); + if (priority == TAO_INVALID_PRIORITY) + return this->create_new_profile (object_key, + mprofile, + priority); else - return this->create_profile (object_key, - mprofile); + return this->create_shared_profile (object_key, + mprofile, + priority); } int -TAO_SHMIOP_Acceptor::create_profile (const TAO_ObjectKey &object_key, - TAO_MProfile &mprofile) +TAO_SHMIOP_Acceptor::create_new_profile (const TAO_ObjectKey &object_key, + TAO_MProfile &mprofile, + CORBA::Short priority) { // @@ we only make one for now int count = mprofile.profile_count (); @@ -107,8 +110,7 @@ TAO_SHMIOP_Acceptor::create_profile (const TAO_ObjectKey &object_key, this->version_, this->orb_core_), -1); - - pfile->endpoint ()->priority (this->priority_); + pfile->endpoint ()->priority (priority); if (mprofile.give_profile (pfile) == -1) { @@ -134,7 +136,8 @@ TAO_SHMIOP_Acceptor::create_profile (const TAO_ObjectKey &object_key, int TAO_SHMIOP_Acceptor::create_shared_profile (const TAO_ObjectKey &object_key, - TAO_MProfile &mprofile) + TAO_MProfile &mprofile, + CORBA::Short priority) { TAO_Profile *pfile = 0; TAO_SHMIOP_Profile *shmiop_profile = 0; @@ -155,7 +158,9 @@ TAO_SHMIOP_Acceptor::create_shared_profile (const TAO_ObjectKey &object_key, { // If <mprofile> doesn't contain SHMIOP_Profile, we need to create // one. - return create_profile (object_key, mprofile); + return create_new_profile (object_key, + mprofile, + priority); } else { @@ -167,7 +172,7 @@ TAO_SHMIOP_Acceptor::create_shared_profile (const TAO_ObjectKey &object_key, this->address_.get_port_number (), this->address_.get_remote_addr ()), -1); - endpoint->priority (this->priority_); + endpoint->priority (priority); shmiop_profile->add_endpoint (endpoint); return 0; @@ -478,30 +483,10 @@ TAO_SHMIOP_Acceptor::parse_options (const char *str) ACE_TEXT ("option name.\n")), -1); - if (name == "priority") - { - CORBA::Short corba_priority = - ACE_static_cast (CORBA::Short, - ACE_OS::atoi (value.c_str ())); - - if (corba_priority >= 0 - /* && corba_priority < 32768 */) - // priority_ and corba_priority will always be less - // than 32768 since CORBA::Short is a signed 16 bit - // integer. - this->priority_ = corba_priority; - else - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("TAO (%P|%t) Invalid SHMIOP endpoint ") - ACE_TEXT ("priority: <%s>\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); + 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/SHMIOP_Acceptor.h b/TAO/tao/Strategies/SHMIOP_Acceptor.h index 1b0bed6851c..293e64c89ab 100644 --- a/TAO/tao/Strategies/SHMIOP_Acceptor.h +++ b/TAO/tao/Strategies/SHMIOP_Acceptor.h @@ -71,9 +71,9 @@ public: int version_minor, const char *options = 0); virtual int close (void); - virtual int create_mprofile (const TAO_ObjectKey &object_key, - TAO_MProfile &mprofile, - CORBA::Boolean share_profile); + virtual int create_profile (const TAO_ObjectKey &object_key, + TAO_MProfile &mprofile, + CORBA::Short priority); virtual int is_collocated (const TAO_Endpoint* endpoint); virtual CORBA::ULong endpoint_count (void); @@ -94,13 +94,14 @@ private: virtual int parse_options (const char *options); // Parse protocol specific options. - int create_profile (const TAO_ObjectKey &object_key, - TAO_MProfile &mprofile); - // Create a SHMIOP profile representing this acceptor. Factors out - // common functionality of <create_mprofile> and <create_shared_mprofile>. + int create_new_profile (const TAO_ObjectKey &object_key, + TAO_MProfile &mprofile, + CORBA::Short priority); + // Create a SHMIOP profile representing this acceptor. int create_shared_profile (const TAO_ObjectKey &object_key, - TAO_MProfile &mprofile); + TAO_MProfile &mprofile, + CORBA::Short priority); // Add the endpoints on this acceptor to a shared profile. protected: diff --git a/TAO/tao/Strategies/UIOP_Acceptor.cpp b/TAO/tao/Strategies/UIOP_Acceptor.cpp index 8c99460db16..516289b207e 100644 --- a/TAO/tao/Strategies/UIOP_Acceptor.cpp +++ b/TAO/tao/Strategies/UIOP_Acceptor.cpp @@ -83,23 +83,27 @@ TAO_UIOP_Acceptor::~TAO_UIOP_Acceptor (void) } int -TAO_UIOP_Acceptor::create_mprofile (const TAO_ObjectKey &object_key, - TAO_MProfile &mprofile, - CORBA::Boolean share_profile) +TAO_UIOP_Acceptor::create_profile (const TAO_ObjectKey &object_key, + TAO_MProfile &mprofile, + CORBA::Short priority) { // Check if multiple endpoints should be put in one profile or // if they should be spread across multiple profiles. - if (share_profile == 1) - return this->create_shared_profile (object_key, - mprofile); + if (priority == TAO_INVALID_PRIORITY) + return this->create_new_profile (object_key, + mprofile, + priority); else - return this->create_profile (object_key, - mprofile); + return this->create_shared_profile (object_key, + mprofile, + priority); + } int -TAO_UIOP_Acceptor::create_profile (const TAO_ObjectKey &object_key, - TAO_MProfile &mprofile) +TAO_UIOP_Acceptor::create_new_profile (const TAO_ObjectKey &object_key, + TAO_MProfile &mprofile, + CORBA::Short priority) { ACE_UNIX_Addr addr; @@ -118,8 +122,7 @@ TAO_UIOP_Acceptor::create_profile (const TAO_ObjectKey &object_key, this->version_, this->orb_core_), -1); - - pfile->endpoint ()->priority (this->priority_); + pfile->endpoint ()->priority (priority); if (mprofile.give_profile (pfile) == -1) { @@ -143,7 +146,8 @@ TAO_UIOP_Acceptor::create_profile (const TAO_ObjectKey &object_key, int TAO_UIOP_Acceptor::create_shared_profile (const TAO_ObjectKey &object_key, - TAO_MProfile &mprofile) + TAO_MProfile &mprofile, + CORBA::Short priority) { TAO_Profile *pfile = 0; TAO_UIOP_Profile *uiop_profile = 0; @@ -164,7 +168,9 @@ TAO_UIOP_Acceptor::create_shared_profile (const TAO_ObjectKey &object_key, { // If <mprofile> doesn't contain UIOP_Profile, we need to create // one. - return create_profile (object_key, mprofile); + return create_new_profile (object_key, + mprofile, + priority); } else { @@ -178,7 +184,7 @@ TAO_UIOP_Acceptor::create_shared_profile (const TAO_ObjectKey &object_key, ACE_NEW_RETURN (endpoint, TAO_UIOP_Endpoint (addr), -1); - endpoint->priority (this->priority_); + endpoint->priority (priority); uiop_profile->add_endpoint (endpoint); return 0; @@ -503,30 +509,10 @@ TAO_UIOP_Acceptor::parse_options (const char *str) "option name.\n"), -1); - if (name == "priority") - { - CORBA::Short corba_priority = - ACE_static_cast (CORBA::Short, - ACE_OS::atoi (value.c_str ())); - - if (corba_priority >= 0 - /* && corba_priority < 32768 */) - // priority_ and corba_priority will always be less - // than 32768 since CORBA::Short is a signed 16 bit - // integer. - this->priority_ = corba_priority; - else - ACE_ERROR_RETURN ((LM_ERROR, - "TAO (%P|%t) Invalid UIOP endpoint " - "priority: <%s>\n", - value.c_str ()), - -1); - } - else - ACE_ERROR_RETURN ((LM_ERROR, - "TAO (%P|%t) Invalid UIOP option: <%s>\n", - name.c_str ()), - -1); + 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/UIOP_Acceptor.h b/TAO/tao/Strategies/UIOP_Acceptor.h index e10acb53267..530dac4bee1 100644 --- a/TAO/tao/Strategies/UIOP_Acceptor.h +++ b/TAO/tao/Strategies/UIOP_Acceptor.h @@ -76,9 +76,9 @@ public: int version_minor, const char *options = 0); virtual int close (void); - virtual int create_mprofile (const TAO_ObjectKey &object_key, - TAO_MProfile &mprofile, - CORBA::Boolean share_profile); + virtual int create_profile (const TAO_ObjectKey &object_key, + TAO_MProfile &mprofile, + CORBA::Short priority); virtual int is_collocated (const TAO_Endpoint* endpoint); virtual CORBA::ULong endpoint_count (void); @@ -101,14 +101,14 @@ private: // Obtains uiop properties that must be used by this acceptor, i.e., // initializes <uiop_properties_>. - int create_profile (const TAO_ObjectKey &object_key, - TAO_MProfile &mprofile); - // Create a UIOP profile representing this acceptor. This method - // factors out common functionality of <create_mprofile> and - // <create_endpoint_for_mprofile>. + int create_new_profile (const TAO_ObjectKey &object_key, + TAO_MProfile &mprofile, + CORBA::Short priority); + // Create a UIOP profile representing this acceptor. int create_shared_profile (const TAO_ObjectKey &object_key, - TAO_MProfile &mprofile); + TAO_MProfile &mprofile, + CORBA::Short priority); // Add the endpoints on this acceptor to a shared profile. private: |