diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-08-01 02:11:33 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-08-01 02:11:33 +0000 |
commit | d6d2acc2e41c1e4b592b2cb33e61dac266cca297 (patch) | |
tree | ddb9cf8fc969a95b83a7474cea80c8b146c84f3d | |
parent | 2fe75c24fc4932f665a9ef7139846bc4a1c481c2 (diff) | |
download | ATCD-d6d2acc2e41c1e4b592b2cb33e61dac266cca297.tar.gz |
Removing the notion of acceptors with priorities...
-rw-r--r-- | TAO/tao/PortableServer/POA.cpp | 6 | ||||
-rw-r--r-- | TAO/tao/RTCORBA/Thread_Pool.cpp | 12 | ||||
-rw-r--r-- | TAO/tao/RTCORBA/Thread_Pool.h | 4 | ||||
-rw-r--r-- | TAO/tao/RTPortableServer/RT_Acceptor_Filters.cpp | 36 | ||||
-rw-r--r-- | TAO/tao/RTPortableServer/RT_Acceptor_Filters.h | 51 | ||||
-rw-r--r-- | TAO/tao/RTPortableServer/RT_POA.cpp | 298 | ||||
-rw-r--r-- | TAO/tao/RTPortableServer/RT_POA.h | 6 | ||||
-rw-r--r-- | TAO/tao/RTPortableServer/RT_Policy_Validator.cpp | 91 |
8 files changed, 225 insertions, 279 deletions
diff --git a/TAO/tao/PortableServer/POA.cpp b/TAO/tao/PortableServer/POA.cpp index 685bdd4c179..9523ebedb71 100644 --- a/TAO/tao/PortableServer/POA.cpp +++ b/TAO/tao/PortableServer/POA.cpp @@ -1110,9 +1110,9 @@ TAO_POA::activate_object_with_id_i (const PortableServer::ObjectId &id, // active in this POA (there is a servant bound to it in the Active // Object Map), the ObjectAlreadyActive exception is raised. int priorities_match = 1; - if (is_user_id_in_map (id, - priority, - priorities_match)) + if (this->is_user_id_in_map (id, + priority, + priorities_match)) { ACE_THROW (PortableServer::POA::ObjectAlreadyActive ()); } diff --git a/TAO/tao/RTCORBA/Thread_Pool.cpp b/TAO/tao/RTCORBA/Thread_Pool.cpp index 54a4b8dafc2..f9af3801b07 100644 --- a/TAO/tao/RTCORBA/Thread_Pool.cpp +++ b/TAO/tao/RTCORBA/Thread_Pool.cpp @@ -216,7 +216,8 @@ TAO_Thread_Pool::TAO_Thread_Pool (TAO_Thread_Pool_Manager &manager, max_buffered_requests_ (max_buffered_requests), max_request_buffer_size_ (max_request_buffer_size), lanes_ (0), - number_of_lanes_ (1) + number_of_lanes_ (1), + with_lanes_ (0) { this->lanes_ = new TAO_Thread_Lane *[this->number_of_lanes_]; this->lanes_[0] = new TAO_Thread_Lane (*this, @@ -244,7 +245,8 @@ TAO_Thread_Pool::TAO_Thread_Pool (TAO_Thread_Pool_Manager &manager, max_buffered_requests_ (max_buffered_requests), max_request_buffer_size_ (max_request_buffer_size), lanes_ (0), - number_of_lanes_ (lanes.length ()) + number_of_lanes_ (lanes.length ()), + with_lanes_ (1) { this->lanes_ = new TAO_Thread_Lane *[this->number_of_lanes_]; for (CORBA::ULong i = 0; @@ -308,6 +310,12 @@ TAO_Thread_Pool::create_static_threads (void) return 0; } +int +TAO_Thread_Pool::with_lanes (void) const +{ + return this->with_lanes_; +} + TAO_Thread_Pool_Manager & TAO_Thread_Pool::manager (void) const { diff --git a/TAO/tao/RTCORBA/Thread_Pool.h b/TAO/tao/RTCORBA/Thread_Pool.h index 45b9e91b1ae..578d592c083 100644 --- a/TAO/tao/RTCORBA/Thread_Pool.h +++ b/TAO/tao/RTCORBA/Thread_Pool.h @@ -175,6 +175,9 @@ public: /// Create the static threads - only called once. int create_static_threads (void); + /// Check if this thread pool has (explicit) lanes. + int with_lanes (void) const; + /// @name Accessors // @{ @@ -205,6 +208,7 @@ private: TAO_Thread_Lane **lanes_; CORBA::ULong number_of_lanes_; + int with_lanes_; }; class TAO_ORB_Core; diff --git a/TAO/tao/RTPortableServer/RT_Acceptor_Filters.cpp b/TAO/tao/RTPortableServer/RT_Acceptor_Filters.cpp index 3bb0531d4e8..76ebf35a09e 100644 --- a/TAO/tao/RTPortableServer/RT_Acceptor_Filters.cpp +++ b/TAO/tao/RTPortableServer/RT_Acceptor_Filters.cpp @@ -66,39 +66,3 @@ validate_acceptor (TAO_Acceptor * /*acceptor*/) { return 1; } - -TAO_Priority_Acceptor_Filter:: -TAO_Priority_Acceptor_Filter (RTCORBA::ProtocolList &protocols, - CORBA::Short priority) - : TAO_Server_Protocol_Acceptor_Filter (protocols), - priority_ (priority) -{ -} - -int -TAO_Priority_Acceptor_Filter::validate_acceptor (TAO_Acceptor *acceptor) -{ - return (this->priority_ == acceptor->priority ()); -} - -TAO_Bands_Acceptor_Filter:: -TAO_Bands_Acceptor_Filter (RTCORBA::ProtocolList &protocols, - RTCORBA::PriorityBands &bands) - : TAO_Server_Protocol_Acceptor_Filter (protocols), - priority_bands_ (bands) -{ -} - -int -TAO_Bands_Acceptor_Filter::validate_acceptor (TAO_Acceptor *acceptor) -{ - for (CORBA::ULong i = 0; - i < this->priority_bands_.length (); - ++i) - { - if (this->priority_bands_[i].low <= acceptor->priority () - && this->priority_bands_[i].high >= acceptor->priority ()) - return 1; - } - return 0; -} diff --git a/TAO/tao/RTPortableServer/RT_Acceptor_Filters.h b/TAO/tao/RTPortableServer/RT_Acceptor_Filters.h index f61f5adb846..2d5aaeda2c5 100644 --- a/TAO/tao/RTPortableServer/RT_Acceptor_Filters.h +++ b/TAO/tao/RTPortableServer/RT_Acceptor_Filters.h @@ -79,57 +79,6 @@ private: // selection. }; -class TAO_RTPortableServer_Export TAO_Priority_Acceptor_Filter : - public TAO_Server_Protocol_Acceptor_Filter -{ - // = TITLE - // RTCORBA::ServerProtocolPolicy & RTCORBA::SERVER_DECLARED - // priority model Acceptor_Filter. - // - // = DESCRIPTION - // Populates mprofile with endpoints that match - // RTCORBA::SERVER_DECLARED priority and - // RTCORBA::ServerProtocolPolicy of the POA. - // -public: - TAO_Priority_Acceptor_Filter (RTCORBA::ProtocolList &protocols, - CORBA::Short priority); - // Constructor. - - virtual int validate_acceptor (TAO_Acceptor *acceptor); - // Returns true if <acceptor>'s priority equals to <priority_>. - -private: - CORBA::Short priority_; - // SERVER_DECLARED priority of the object. -}; - -class TAO_RTPortableServer_Export TAO_Bands_Acceptor_Filter : - public TAO_Server_Protocol_Acceptor_Filter -{ - // = TITLE - // RTCORBA::PriorityBandedConnectionPolicy & - // RTCORBA::ServerProtocolPolicy Acceptor_Filter. - // - // = DESCRIPTION - // Populates mprofile with endpoints that match - // RTCORBA::PriorityBandedConnectionPolicy and - // RTCORBA::ServerProtocolPolicy of the POA. - // -public: - TAO_Bands_Acceptor_Filter (RTCORBA::ProtocolList &protocols, - RTCORBA::PriorityBands &bands); - // Constructor. - - virtual int validate_acceptor (TAO_Acceptor *acceptor); - // Returns true if <acceptor>'s priority falls into the range of any - // of the <priority_bands_>. - -private: - RTCORBA::PriorityBands &priority_bands_; - // The value of POA's PriorityBandedConnectionPolicy. -}; - #if defined (__ACE_INLINE__) #include "RT_Acceptor_Filters.i" #endif /* __ACE_INLINE__ */ diff --git a/TAO/tao/RTPortableServer/RT_POA.cpp b/TAO/tao/RTPortableServer/RT_POA.cpp index 52168a40766..e4a0bb793c9 100644 --- a/TAO/tao/RTPortableServer/RT_POA.cpp +++ b/TAO/tao/RTPortableServer/RT_POA.cpp @@ -131,55 +131,24 @@ void TAO_RT_POA::valid_priority (RTCORBA::Priority priority, CORBA_Environment &ACE_TRY_ENV) { - // Make sure <priority> matches our resource configuration: - // 1. If Priority Banded Connections are set, <priority> must match - // one of the bands. - // 2. If no Priority Banded Connections are set, at least one server - // endpoint must provide service at the specified <priority>. - - // @@ RT CORBA Subsetting: optimize out locks. - CORBA::Policy_var policy = - this->policies ().get_cached_policy (TAO_CACHED_POLICY_RT_PRIORITY_BANDED_CONNECTION); - - RTCORBA::PriorityBandedConnectionPolicy_var priority_bands - = RTCORBA::PriorityBandedConnectionPolicy::_narrow (policy.in (), - ACE_TRY_ENV); - ACE_CHECK; - - TAO_PriorityBandedConnectionPolicy *bands_policy = - ACE_dynamic_cast (TAO_PriorityBandedConnectionPolicy *, - priority_bands.in ()); - - if (bands_policy != 0) - // Case 1. + // 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 && + this->thread_pool_->with_lanes ()) { - RTCORBA::PriorityBands &bands = - bands_policy->priority_bands_rep (); + TAO_Thread_Lane **lanes = + this->thread_pool_->lanes (); - for (CORBA::ULong i = 0; i < bands.length (); ++i) + for (CORBA::ULong i = 0; + i != this->thread_pool_->number_of_lanes (); + ++i) { - if (priority <= bands[i].high - && priority >= bands[i].low) + if (lanes[i]->lane_priority () == priority) return; } - } - else - // Case 2. - { - TAO_Acceptor_Registry *ar = - TAO_POA_RT_Policy_Validator::extract_acceptor_registry (this->orb_core_, - this->thread_pool_); - for (TAO_Acceptor **a = ar->begin (); - a != ar->end (); - ++a) - { - if ((*a)->priority () == priority) - return; - } + ACE_THROW (CORBA::BAD_PARAM ()); } - - ACE_THROW (CORBA::BAD_PARAM ()); } void @@ -212,31 +181,39 @@ TAO_RT_POA::validate_policies (CORBA::Environment &ACE_TRY_ENV) // observed. } -size_t -TAO_RT_POA::endpoint_count (void) +TAO_Stub * +TAO_RT_POA::key_to_stub_i (const TAO_ObjectKey &object_key, + const char *type_id, + CORBA::Short priority, + CORBA_Environment &ACE_TRY_ENV) { - size_t profile_count = 0; + // Client exposed policies. + CORBA::PolicyList_var client_exposed_policies = + this->client_exposed_policies (priority, + ACE_TRY_ENV); + ACE_CHECK_RETURN (0); - TAO_Thread_Lane **lanes = - this->thread_pool_->lanes (); + // Server protocol policy. + CORBA::Policy_var protocol = + this->policies ().get_cached_policy (TAO_CACHED_POLICY_RT_SERVER_PROTOCOL); - for (CORBA::ULong i = 0; - i != this->thread_pool_->number_of_lanes (); - ++i) - profile_count += - lanes[i]->resources ().acceptor_registry ().endpoint_count (); + RTCORBA::ServerProtocolPolicy_var server_protocol_policy = + RTCORBA::ServerProtocolPolicy::_narrow (protocol.in (), + ACE_TRY_ENV); + ACE_CHECK_RETURN (0); - return profile_count; -} + TAO_ServerProtocolPolicy *server_protocol = + ACE_dynamic_cast (TAO_ServerProtocolPolicy *, + server_protocol_policy.in ()); -TAO_Stub * -TAO_RT_POA::create_stub_object (const TAO_ObjectKey &object_key, - const char *type_id, - CORBA::PolicyList *policy_list, - TAO_Acceptor_Filter *filter, - CORBA::Environment &ACE_TRY_ENV) -{ - if (this->thread_pool_ == 0) + // Filter for server protocol. + TAO_Server_Protocol_Acceptor_Filter filter (server_protocol->protocols_rep ()); + + // If this POA is using the default thread pool or a thread pool + // without lanes, create the IOR with the acceptors in the thread + // pool. + if (this->thread_pool_ == 0 || + !this->thread_pool_->with_lanes ()) { TAO_Acceptor_Registry *acceptor_registry = TAO_POA_RT_Policy_Validator::extract_acceptor_registry (this->orb_core_, @@ -245,12 +222,69 @@ TAO_RT_POA::create_stub_object (const TAO_ObjectKey &object_key, return this->TAO_POA::create_stub_object (object_key, type_id, - policy_list, - filter, + client_exposed_policies._retn (), + &filter, *acceptor_registry, ACE_TRY_ENV); } + // If this POA has the SERVER_DECLARED policy, create the IOR with + // the acceptors in the only thread lane that matches the priority + // of the object. + if (this->cached_policies_.priority_model () == + TAO_POA_Cached_Policies::SERVER_DECLARED) + { + TAO_Thread_Lane **lanes = + this->thread_pool_->lanes (); + + for (CORBA::ULong i = 0; + i != this->thread_pool_->number_of_lanes (); + ++i) + { + if (lanes[i]->lane_priority () == priority) + return this->TAO_POA::create_stub_object (object_key, + type_id, + client_exposed_policies._retn (), + &filter, + lanes[i]->resources ().acceptor_registry (), + ACE_TRY_ENV); + } + + ACE_ASSERT (0); + } + + // If this POA has the CLIENT_PROPAGATED policy, create the IOR with + // the acceptors in the thread lanes that matches the bands in this + // POA. If there are no bands, all the thread lanes are used. + CORBA::Policy_var bands = + this->policies ().get_cached_policy (TAO_CACHED_POLICY_RT_PRIORITY_BANDED_CONNECTION); + + RTCORBA::PriorityBandedConnectionPolicy_var priority_bands + = RTCORBA::PriorityBandedConnectionPolicy::_narrow (bands.in (), + ACE_TRY_ENV); + ACE_CHECK_RETURN (0); + + TAO_PriorityBandedConnectionPolicy *priority_bands_i = + ACE_dynamic_cast (TAO_PriorityBandedConnectionPolicy *, + priority_bands.in ()); + + + return this->create_stub_object (object_key, + type_id, + client_exposed_policies._retn (), + &filter, + priority_bands_i, + ACE_TRY_ENV); +} + +TAO_Stub * +TAO_RT_POA::create_stub_object (const TAO_ObjectKey &object_key, + const char *type_id, + CORBA::PolicyList *policy_list, + TAO_Acceptor_Filter *filter, + TAO_PriorityBandedConnectionPolicy *priority_bands, + CORBA::Environment &ACE_TRY_ENV) +{ int error = 0; // Count the number of endpoints. @@ -279,16 +313,20 @@ TAO_RT_POA::create_stub_object (const TAO_ObjectKey &object_key, !error; ++i) { - TAO_Acceptor_Registry &acceptor_registry = - lanes[i]->resources ().acceptor_registry (); - - result = - filter->fill_mprofile (object_key, - mprofile, - acceptor_registry.begin (), - acceptor_registry.end ()); - if (result == -1) - error = 1; + if (this->lane_required (lanes[i], + priority_bands)) + { + TAO_Acceptor_Registry &acceptor_registry = + lanes[i]->resources ().acceptor_registry (); + + result = + filter->fill_mprofile (object_key, + mprofile, + acceptor_registry.begin (), + acceptor_registry.end ()); + if (result == -1) + error = 1; + } } if (!error) @@ -322,101 +360,43 @@ TAO_RT_POA::create_stub_object (const TAO_ObjectKey &object_key, ACE_TRY_ENV); } -TAO_Stub * -TAO_RT_POA::key_to_stub_i (const TAO_ObjectKey &key, - const char *type_id, - CORBA::Short priority, - CORBA_Environment &ACE_TRY_ENV) +size_t +TAO_RT_POA::endpoint_count (void) { - CORBA::PolicyList_var client_exposed_policies = - this->client_exposed_policies (priority, - ACE_TRY_ENV); - ACE_CHECK_RETURN (0); - - TAO_Stub *data = 0; - - CORBA::Policy_var protocol = - this->policies ().get_cached_policy (TAO_CACHED_POLICY_RT_SERVER_PROTOCOL); - - RTCORBA::ServerProtocolPolicy_var server_protocol_policy = - RTCORBA::ServerProtocolPolicy::_narrow (protocol.in (), - ACE_TRY_ENV); - ACE_CHECK_RETURN (0); - - TAO_ServerProtocolPolicy *server_protocol = - ACE_dynamic_cast (TAO_ServerProtocolPolicy *, - server_protocol_policy.in ()); + size_t profile_count = 0; + TAO_Thread_Lane **lanes = + this->thread_pool_->lanes (); - // If the POA has RTCORBA::SERVER_DECLARED priority model - // then regardless of the fact that there are or that there - // are not bands then we need to pass only one endpoint that - // is either the one associated to the bands to which the - // server belongs, or the one associated to the server priority. - // - // If the POA has RTCORBA::CLIENT_EXPOSED, than all endpoints - // should be passed. + for (CORBA::ULong i = 0; + i != this->thread_pool_->number_of_lanes (); + ++i) + profile_count += + lanes[i]->resources ().acceptor_registry ().endpoint_count (); - if (this->cached_policies_.priority_model () - == TAO_POA_Cached_Policies::SERVER_DECLARED) - { - CORBA::Policy_var bands = - this->policies ().get_cached_policy (TAO_CACHED_POLICY_RT_PRIORITY_BANDED_CONNECTION); + return profile_count; +} - RTCORBA::PriorityBandedConnectionPolicy_var priority_bands - = RTCORBA::PriorityBandedConnectionPolicy::_narrow (bands.in (), - ACE_TRY_ENV); - ACE_CHECK_RETURN (0); +int +TAO_RT_POA::lane_required (TAO_Thread_Lane *lane, + TAO_PriorityBandedConnectionPolicy *priority_bands) +{ + if (priority_bands == 0) + return 1; - TAO_PriorityBandedConnectionPolicy *priority_bands_i = - ACE_dynamic_cast (TAO_PriorityBandedConnectionPolicy *, - priority_bands.in ()); + RTCORBA::PriorityBands &bands = + priority_bands->priority_bands_rep (); - if (priority_bands_i != 0) - { - TAO_Bands_Acceptor_Filter - filter (server_protocol->protocols_rep (), - priority_bands_i->priority_bands_rep()); - - data = - this->create_stub_object (key, - type_id, - client_exposed_policies._retn (), - &filter, - ACE_TRY_ENV); - ACE_CHECK_RETURN (0); - } - else - { - RTCORBA::Priority object_priority = - this->cached_policies_.server_priority () > priority ? - this->cached_policies_.server_priority () : priority; - TAO_Priority_Acceptor_Filter filter (server_protocol->protocols_rep (), - object_priority); - - data = - this->create_stub_object (key, - type_id, - client_exposed_policies._retn (), - &filter, - ACE_TRY_ENV); - ACE_CHECK_RETURN (0); - } - } - else + for (CORBA::ULong i = 0; + i < bands.length (); + ++i) { - // Client propagated. - TAO_Server_Protocol_Acceptor_Filter filter (server_protocol->protocols_rep ()); - data = - this->create_stub_object (key, - type_id, - client_exposed_policies._retn (), - &filter, - ACE_TRY_ENV); - ACE_CHECK_RETURN (0); + if (bands[i].low <= lane->lane_priority () && + bands[i].high >= lane->lane_priority ()) + return 1; } - return data; + return 0; } CORBA::PolicyList * diff --git a/TAO/tao/RTPortableServer/RT_POA.h b/TAO/tao/RTPortableServer/RT_POA.h index 70b7c4ee12b..d6da1873ebf 100644 --- a/TAO/tao/RTPortableServer/RT_POA.h +++ b/TAO/tao/RTPortableServer/RT_POA.h @@ -40,6 +40,8 @@ #endif /* _MSC_VER */ class TAO_Thread_Pool; +class TAO_Thread_Lane; +class TAO_PriorityBandedConnectionPolicy; class TAO_RTPortableServer_Export TAO_RT_POA : public virtual RTPortableServer::POA, @@ -298,8 +300,12 @@ protected: const char *type_id, CORBA::PolicyList *policy_list, TAO_Acceptor_Filter *filter, + TAO_PriorityBandedConnectionPolicy *priority_bands, CORBA::Environment &ACE_TRY_ENV); + int lane_required (TAO_Thread_Lane *lane, + TAO_PriorityBandedConnectionPolicy *priority_bands); + TAO_Thread_Pool *thread_pool_; }; diff --git a/TAO/tao/RTPortableServer/RT_Policy_Validator.cpp b/TAO/tao/RTPortableServer/RT_Policy_Validator.cpp index f3272685092..422fb586e01 100644 --- a/TAO/tao/RTPortableServer/RT_Policy_Validator.cpp +++ b/TAO/tao/RTPortableServer/RT_Policy_Validator.cpp @@ -148,20 +148,19 @@ TAO_POA_RT_Policy_Validator::validate_priorities (TAO_Policy_Set &policies, priority_bands.in ()); // If priority banded connections are set, make sure that: - // 0. There is at least one band. - // 1. Priority model is also set. + // 1. There is at least one band. // 2. If priority model is SERVER_DECLARED, server_priority must - // match one of the bands. - // 3. For each band, there must be at least one endpoint that can - // service it, i.e., whose priority falls into the band's range. + // match one of the bands. + // 3. 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) { RTCORBA::PriorityBands &bands = bands_policy->priority_bands_rep (); - // Checks 0 and 1. - if (bands.length () == 0 - || priority == TAO_INVALID_PRIORITY) + // Checks 1. + if (bands.length () == 0) ACE_THROW (PortableServer::POA::InvalidPolicy ()); // Check 2. @@ -170,8 +169,8 @@ TAO_POA_RT_Policy_Validator::validate_priorities (TAO_Policy_Set &policies, int match = 0; for (CORBA::ULong i = 0; i < bands.length (); ++i) { - if (priority <= bands[i].high - && priority >= bands[i].low) + if (priority <= bands[i].high && + priority >= bands[i].low) { match = 1; break; @@ -182,23 +181,38 @@ TAO_POA_RT_Policy_Validator::validate_priorities (TAO_Policy_Set &policies, ACE_THROW (PortableServer::POA::InvalidPolicy ()); } + // // Check 3. - TAO_Acceptor_Registry *ar = - this->acceptor_registry (); + // + + // If this POA is using the default thread pool (which doesn't + // have lanes) or a thread pool without lanes, we are done with + // the checks. + if (this->thread_pool_ == 0 || + !this->thread_pool_->with_lanes ()) + return; + + // If this POA is using a thread pool with lanes, make sure we + // have at least one thread lane that corresponds to these + // each band. + TAO_Thread_Lane **lanes = + this->thread_pool_->lanes (); - for (CORBA::ULong i = 0; i < bands.length (); ++i) + for (CORBA::ULong band = 0; + band < bands.length (); + ++band) { int match = 0; - for (TAO_AcceptorSetIterator a = ar->begin (); - a != ar->end (); - ++a) + for (CORBA::ULong lane = 0; + lane != this->thread_pool_->number_of_lanes () && !match; + ++lane) { - if ((*a)->priority () <= bands[i].high - && (*a)->priority () >= bands[i].low) - { - match = 1; - break; - } + CORBA::Short lane_priority = + lanes[lane]->lane_priority (); + + if (lane_priority <= bands[band].high && + lane_priority >= bands[band].low) + match = 1; } if (!match) ACE_THROW (PortableServer::POA::InvalidPolicy ()); @@ -214,17 +228,38 @@ TAO_POA_RT_Policy_Validator::validate_priorities (TAO_Policy_Set &policies, // priority. if (rt_priority_model == RTCORBA::SERVER_DECLARED) { - TAO_Acceptor_Registry *ar = - this->acceptor_registry (); + // If this POA is using the default thread pool (which doesn't + // have lanes) or a thread pool without lanes, we are done with + // the checks. + if (this->thread_pool_ == 0 || + !this->thread_pool_->with_lanes ()) + return; + + // If this POA is using a thread pool with lanes, make sure we + // have at least one thread lane that corresponds to these + // each band. + TAO_Thread_Lane **lanes = + this->thread_pool_->lanes (); - for (TAO_AcceptorSetIterator a = ar->begin (); a != ar->end (); ++a) + int match = 0; + for (CORBA::ULong lane = 0; + lane != this->thread_pool_->number_of_lanes () && !match; + ++lane) { - if ((*a)->priority () == priority) - return; + CORBA::Short lane_priority = + lanes[lane]->lane_priority (); + + if (lane_priority <= priority && + lane_priority >= priority) + match = 1; } + if (!match) + ACE_THROW (PortableServer::POA::InvalidPolicy ()); - ACE_THROW (CORBA::BAD_PARAM ()); + // Done with checks. + return; } + } void |