void TAO_RT_POA::validate_priority (RTCORBA::Priority priority) { if (priority < RTCORBA::minPriority // The line below will always be false unless the value of // RTCORBA::maxPriority, which is now assigned the value of // 32767, is changed in RTCORBA.pidl. // || priority > RTCORBA::maxPriority ) { throw ::CORBA::BAD_PARAM (); } // If this POA is using a thread pool with lanes, make sure the // priority matches one of the thread lanes. Note that in this // case, bands do not matter since matching the lanes priority is a // stricter condition than meeting the band ranges. In addition, // when the POA was created, the bands had to match the lanes. if (this->thread_pool_ != 0 && this->thread_pool_->with_lanes ()) { 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; } throw ::CORBA::BAD_PARAM (); } else // Else we are dealing with a thread pool without lanes. { // Check if we have bands. 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 ()); TAO_PriorityBandedConnectionPolicy *priority_bands_i = dynamic_cast <TAO_PriorityBandedConnectionPolicy *> (priority_bands.in ()); if (priority_bands_i) { // If we do have bands, make sure that the priority is // matching one of the bands. RTCORBA::PriorityBands &bands = priority_bands_i->priority_bands_rep (); for (CORBA::ULong i = 0; i < bands.length (); ++i) { if (bands[i].low <= priority && bands[i].high >= priority) return; } throw ::CORBA::BAD_PARAM (); } } }