diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2002-08-15 17:45:40 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2002-08-15 17:45:40 +0000 |
commit | 8eca0515ad35a1ae4c3c4a104ebe22af88d490b4 (patch) | |
tree | 18cf75fb11c510e89299d5e6d9c37caf2b154a6f | |
parent | 352164ae795584a8d567dabe17fb2fe8e0238d24 (diff) | |
download | ATCD-8eca0515ad35a1ae4c3c4a104ebe22af88d490b4.tar.gz |
ChangeLogTag:Thu Aug 15 10:45:00 2002 Ossama Othman <ossama@uci.edu>
-rw-r--r-- | TAO/ChangeLog | 35 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LoadBalancing/LB_IORInterceptor.cpp | 140 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LoadBalancing/LB_IORInterceptor.h | 12 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Random.cpp | 11 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.cpp | 8 |
5 files changed, 130 insertions, 76 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 06c6bc00364..332f071b5cc 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,30 @@ +Thu Aug 15 10:45:00 2002 Ossama Othman <ossama@uci.edu> + + * orbsvcs/orbsvcs/LoadBalancing/LB_IORInterceptor.h: + * orbsvcs/orbsvcs/LoadBalancing/LB_IORInterceptor.cpp: + + Temporarily disabled LoadAlert object registration. There are + some order-of-execution and concurrency issues that must be + resolved. This will be fixed prior for the TAO 1.3 release. + + * orbsvcs/orbsvcs/LoadBalancing/LB_Random.cpp (next_member): + + Fixed problem where the full range of object group members were + not selected due to integer arithmetic overflow. Store the + value that sets the maximum random number in a "float" prior to + using it in the random number computation. This forces floating + point arithmetic to be used when computing the random number. + + * orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.cpp + (add_member): + + Added some comments to some potentially confusing code. + + (member_already_present): + + Compare ObjectGroupIds instead of object group hash map entry + pointers. Even though it worked, the latter was too brittle. + Wed Aug 14 21:32:36 2002 Ossama Othman <ossama@uci.edu> * orbsvcs/orbsvcs/LoadBalancing/LB_LeastLoaded.h (get_location): @@ -67,7 +94,7 @@ Wed Aug 14 10:57:52 2002 Ossama Othman <ossama@uci.edu> Added a protected destructor to enforce proper memory management through reference counting. - + * orbsvcs/orbsvcs/LoadBalancing/LB_CPU_Monitor.cpp: Added a no-op destructor. @@ -137,7 +164,7 @@ Wed Aug 14 10:57:52 2002 Ossama Othman <ossama@uci.edu> The implementation of these methods has been greatly simplified due the above change. - + * orbsvcs/orbsvcs/LoadBalancing/LB_ORBInitializer.h: Removed extraneous "LoadBalancing_export.h" include. @@ -155,7 +182,7 @@ Wed Aug 14 10:57:52 2002 Ossama Othman <ossama@uci.edu> Updated Hash_Map explicit template instantiations in accordance with the above fix. - + (make_object): Removed LoadAlert object registration code. Registration is now @@ -508,7 +535,7 @@ Mon Aug 12 10:18:49 2002 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu> * PROBLEM-REPORT-FORM: Fixed a typo where "ASCII text" was spelled "ASCII test". Thanks to Eric Newton <ecn@metaslash.com> for - reporting this. + reporting this. Mon Aug 12 10:02:29 2002 Nanbor Wang <nanbor@cs.wustl.edu> diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_IORInterceptor.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_IORInterceptor.cpp index 78eb712c0af..5c68bdb08a2 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_IORInterceptor.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_IORInterceptor.cpp @@ -16,15 +16,15 @@ TAO_LB_IORInterceptor::TAO_LB_IORInterceptor ( const char * location, CosLoadBalancing::LoadManager_ptr lm, const char * orb_id, - TAO_LB_LoadAlert & load_alert) + TAO_LB_LoadAlert & /* load_alert */) : object_groups_ (object_groups), repository_ids_ (repository_ids), location_ (location), lm_ (CosLoadBalancing::LoadManager::_duplicate (lm)), - orb_id_ (CORBA::string_dup (orb_id)), - load_alert_ (load_alert), - la_ref_ (), - lock_ () + orb_id_ (CORBA::string_dup (orb_id)) +// , load_alert_ (load_alert) +// , la_ref_ () +// , lock_ () { } @@ -95,73 +95,91 @@ TAO_LB_IORInterceptor::components_established ( void TAO_LB_IORInterceptor::adapter_manager_state_changed ( PortableInterceptor::AdapterManagerId, - PortableInterceptor::AdapterState state - ACE_ENV_ARG_DECL) + PortableInterceptor::AdapterState /* state */ + ACE_ENV_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException)) { - if (state == PortableInterceptor::ACTIVE) - { - this->register_load_alert (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - } +// if (state == PortableInterceptor::ACTIVE) +// { +// this->register_load_alert (ACE_ENV_SINGLE_ARG_PARAMETER); +// ACE_CHECK; +// } } void TAO_LB_IORInterceptor::adapter_state_changed ( const PortableInterceptor::ObjectReferenceTemplateSeq &, - PortableInterceptor::AdapterState state - ACE_ENV_ARG_DECL) + PortableInterceptor::AdapterState /* state */ + ACE_ENV_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException)) { - if (state == PortableInterceptor::ACTIVE) - { - this->register_load_alert (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - } +// if (state == PortableInterceptor::ACTIVE) +// { +// this->register_load_alert (ACE_ENV_SINGLE_ARG_PARAMETER); +// ACE_CHECK; +// } } void -TAO_LB_IORInterceptor::register_load_alert (ACE_ENV_SINGLE_ARG_DECL) +TAO_LB_IORInterceptor::register_load_alert (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) { - { - ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->lock_); - - if (!CORBA::is_nil (this->la_ref_.in ())) - return; - - // By now, the RootPOA has been fully initialized, so it is safe - // to activate the LoadAlert object. - this->la_ref_ = this->load_alert_._this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - } - - ACE_TRY - { - PortableGroup::Location location (1); - location.length (1); - location[0].id = CORBA::string_dup (this->location_.in ()); - - this->lm_->register_load_alert (location, - this->la_ref_.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCH (CosLoadBalancing::LoadAlertAlreadyPresent, ex) - { - if (TAO_debug_level > 0) - ACE_PRINT_EXCEPTION (ex, - "LoadManager::register_load_alert"); - - ACE_TRY_THROW (CORBA::BAD_INV_ORDER ()); - } - ACE_CATCH (CosLoadBalancing::LoadAlertNotAdded, ex) - { - if (TAO_debug_level > 0) - ACE_PRINT_EXCEPTION (ex, - "LoadManager::register_load_alert"); - - ACE_TRY_THROW (CORBA::INTERNAL ()); - } - ACE_ENDTRY; - ACE_CHECK; +// { +// ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->lock_); + +// if (!CORBA::is_nil (this->la_ref_.in ())) +// return; +// } + +// ACE_TRY_EX (foo) +// { +// // By now, the RootPOA has been fully initialized, so it is safe +// // to activate the LoadAlert object. +// CosLoadBalancing::LoadAlert_var la = +// this->load_alert_._this (ACE_ENV_SINGLE_ARG_PARAMETER); +// ACE_TRY_CHECK_EX (foo); + +// { +// ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->lock_); + +// this->la_ref_ = la; +// } + +// } +// ACE_CATCHANY +// { +// ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, +// "LoadAlert::_this()"); +// } +// ACE_ENDTRY; +// ACE_CHECK; + +// ACE_TRY +// { +// PortableGroup::Location location (1); +// location.length (1); +// location[0].id = CORBA::string_dup (this->location_.in ()); + +// this->lm_->register_load_alert (location, +// this->la_ref_.in () +// ACE_ENV_ARG_PARAMETER); +// ACE_TRY_CHECK; +// } +// ACE_CATCH (CosLoadBalancing::LoadAlertAlreadyPresent, ex) +// { +// if (TAO_debug_level > 0) +// ACE_PRINT_EXCEPTION (ex, +// "LoadManager::register_load_alert"); + +// ACE_TRY_THROW (CORBA::BAD_INV_ORDER ()); +// } +// ACE_CATCH (CosLoadBalancing::LoadAlertNotAdded, ex) +// { +// if (TAO_debug_level > 0) +// ACE_PRINT_EXCEPTION (ex, +// "LoadManager::register_load_alert"); + +// ACE_TRY_THROW (CORBA::INTERNAL ()); +// } +// ACE_ENDTRY; +// ACE_CHECK; } diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_IORInterceptor.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_IORInterceptor.h index 7043ff19be8..609d0ec2cf6 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_IORInterceptor.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_IORInterceptor.h @@ -129,14 +129,14 @@ private: /// ORBid of the ORB this IORInterceptor is registered with. CORBA::String_var orb_id_; - /// Reference to the LoadAlert servant. - TAO_LB_LoadAlert & load_alert_; +// /// Reference to the LoadAlert servant. +// TAO_LB_LoadAlert & load_alert_; - /// Reference to the LoadAlert object. - CosLoadBalancing::LoadAlert_var la_ref_; +// /// Reference to the LoadAlert object. +// CosLoadBalancing::LoadAlert_var la_ref_; - /// Synchronize access to the class state. - TAO_SYNCH_MUTEX lock_; +// /// Synchronize access to the class state. +// TAO_SYNCH_MUTEX lock_; }; diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Random.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Random.cpp index a92d67f67c2..a81e3371a32 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Random.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Random.cpp @@ -81,16 +81,19 @@ TAO_LB_Random::next_member ( // is supposed to have a larger period than rand(), in // addition to the fact that the lower order bits should be as // random as the higher order bits. + + const CORBA::Float flen = len; // Prevent integer arithmetic + // overflow. const CORBA::ULong i = ACE_static_cast (CORBA::ULong, - (len * ACE_OS::rand () / (RAND_MAX + 1.0))); + flen * ACE_OS::rand () / (RAND_MAX + 1.0)); ACE_ASSERT (i < len); // ACE_DEBUG ((LM_DEBUG, -// "** Len = %u\n" -// "Location # %u\n" -// "Loc Name = %s\n", +// "** Len = %u\t" +// "Location # %u\t" +// "Loc Name = \"%s\"\n", // len, // i, // locations[i][0].id.in ())); diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.cpp index 933c997f489..eb6a5dc0d5e 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.cpp @@ -134,6 +134,9 @@ TAO_PG_ObjectGroupManager::add_member ( (void) safe_groups.release (); } + // No object group member of the object group with the given + // ObjectGroupId resides at the location. Add the object group + // entry to array of object groups residing at the location. const size_t groups_len = groups->size (); groups->size (groups_len + 1); (*groups)[groups_len] = group_entry; @@ -512,7 +515,10 @@ TAO_PG_ObjectGroupManager::member_already_present ( size_t len = groups.size (); for (size_t i = 0; i < len; ++i) { - if (groups[i] == group_entry) + // It should be enough just to compare the group_entry pointers, + // but that seems brittle. Better to check a controlled value, + // like the ObjectGroupId. + if (groups[i]->group_id == group_entry->group_id) { // Member with given type ID exists at the given // location. |