diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2002-08-14 17:58:36 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2002-08-14 17:58:36 +0000 |
commit | c5a87b7fade88c35d033c273fc7c5d55ec09a3b6 (patch) | |
tree | d96b5b04a2b89d8c2340d3f0f308c960824accec /TAO/orbsvcs | |
parent | 6dca348a2a1439abab1bf31a835cf5bfc3d4ad0b (diff) | |
download | ATCD-c5a87b7fade88c35d033c273fc7c5d55ec09a3b6.tar.gz |
ChangeLogTag:Wed Aug 14 10:57:52 2002 Ossama Othman <ossama@uci.edu>
Diffstat (limited to 'TAO/orbsvcs')
29 files changed, 378 insertions, 523 deletions
diff --git a/TAO/orbsvcs/LoadBalancer/Makefile.LoadManager b/TAO/orbsvcs/LoadBalancer/Makefile.LoadManager index ee52fc2eea7..0e200593978 100644 --- a/TAO/orbsvcs/LoadBalancer/Makefile.LoadManager +++ b/TAO/orbsvcs/LoadBalancer/Makefile.LoadManager @@ -396,29 +396,12 @@ CPPFLAGS += -I$(TAO_ROOT)/orbsvcs -I$(TAO_ROOT) $(TAO_ROOT)/orbsvcs/orbsvcs/CosLoadBalancingS.i \ $(TAO_ROOT)/orbsvcs/orbsvcs/LoadBalancing/LB_LoadAlertMap.h \ $(TAO_ROOT)/orbsvcs/orbsvcs/LoadBalancing/LB_LoadAlertInfo.h \ - $(TAO_ROOT)/tao/PortableServer/Key_Adapters.h \ - $(ACE_ROOT)/ace/Map_T.h \ - $(ACE_ROOT)/ace/Pair_T.h \ - $(ACE_ROOT)/ace/Pair_T.i \ - $(ACE_ROOT)/ace/Pair_T.cpp \ - $(ACE_ROOT)/ace/Map_Manager.h \ - $(ACE_ROOT)/ace/Map_Manager.i \ - $(ACE_ROOT)/ace/Map_Manager.cpp \ - $(ACE_ROOT)/ace/Hash_Map_Manager.h \ - $(ACE_ROOT)/ace/Active_Map_Manager.h \ - $(ACE_ROOT)/ace/Active_Map_Manager.i \ - $(ACE_ROOT)/ace/Active_Map_Manager_T.h \ - $(ACE_ROOT)/ace/Active_Map_Manager_T.i \ - $(ACE_ROOT)/ace/Active_Map_Manager_T.cpp \ - $(ACE_ROOT)/ace/Map_T.i \ - $(ACE_ROOT)/ace/Map_T.cpp \ - $(TAO_ROOT)/tao/PortableServer/Key_Adapters.i \ - $(TAO_ROOT)/orbsvcs/orbsvcs/LoadBalancing/LB_MonitorMap.h \ $(TAO_ROOT)/orbsvcs/orbsvcs/PortableGroup/PG_Location_Hash.h \ $(TAO_ROOT)/orbsvcs/orbsvcs/PortableGroup/PG_Location_Hash.inl \ $(TAO_ROOT)/orbsvcs/orbsvcs/PortableGroup/PG_Location_Equal_To.h \ $(TAO_ROOT)/orbsvcs/orbsvcs/PortableGroup/PG_Operators.h \ $(TAO_ROOT)/orbsvcs/orbsvcs/PortableGroup/PG_Location_Equal_To.inl \ + $(TAO_ROOT)/orbsvcs/orbsvcs/LoadBalancing/LB_MonitorMap.h \ $(TAO_ROOT)/orbsvcs/orbsvcs/LoadBalancing/LB_LoadListMap.h \ $(TAO_ROOT)/orbsvcs/orbsvcs/LoadBalancing/LB_Pull_Handler.h \ $(TAO_ROOT)/orbsvcs/orbsvcs/PortableGroup/PG_PropertyManager.h \ @@ -432,6 +415,23 @@ CPPFLAGS += -I$(TAO_ROOT)/orbsvcs -I$(TAO_ROOT) $(TAO_ROOT)/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.h \ $(TAO_ROOT)/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroup_Map.h \ $(TAO_ROOT)/orbsvcs/orbsvcs/PortableGroup/PG_MemberInfo.h \ + $(TAO_ROOT)/tao/PortableServer/Key_Adapters.h \ + $(ACE_ROOT)/ace/Map_T.h \ + $(ACE_ROOT)/ace/Pair_T.h \ + $(ACE_ROOT)/ace/Pair_T.i \ + $(ACE_ROOT)/ace/Pair_T.cpp \ + $(ACE_ROOT)/ace/Map_Manager.h \ + $(ACE_ROOT)/ace/Map_Manager.i \ + $(ACE_ROOT)/ace/Map_Manager.cpp \ + $(ACE_ROOT)/ace/Hash_Map_Manager.h \ + $(ACE_ROOT)/ace/Active_Map_Manager.h \ + $(ACE_ROOT)/ace/Active_Map_Manager.i \ + $(ACE_ROOT)/ace/Active_Map_Manager_T.h \ + $(ACE_ROOT)/ace/Active_Map_Manager_T.i \ + $(ACE_ROOT)/ace/Active_Map_Manager_T.cpp \ + $(ACE_ROOT)/ace/Map_T.i \ + $(ACE_ROOT)/ace/Map_T.cpp \ + $(TAO_ROOT)/tao/PortableServer/Key_Adapters.i \ $(TAO_ROOT)/orbsvcs/orbsvcs/PortableGroup/PG_Location_Map.h \ $(TAO_ROOT)/tao/ORB_Core.h \ $(TAO_ROOT)/tao/Policy_Manager.h \ diff --git a/TAO/orbsvcs/orbsvcs/CosLoadBalancing.idl b/TAO/orbsvcs/orbsvcs/CosLoadBalancing.idl index e2697e5cc12..a115c121647 100644 --- a/TAO/orbsvcs/orbsvcs/CosLoadBalancing.idl +++ b/TAO/orbsvcs/orbsvcs/CosLoadBalancing.idl @@ -119,7 +119,7 @@ module CosLoadBalancing { // Forward requests back to the load manager via the object group // reference. - void enable_alert (in Object object_group); + void enable_alert (); // Stop forwarding requests, and begin accepting them again. void disable_alert (); @@ -152,40 +152,30 @@ module CosLoadBalancing raises (LocationNotFound); // Inform member at given location of load alert condition. - void enable_alert (in PortableGroup::ObjectGroup object_group, - in PortableGroup::Location the_location) - raises (PortableGroup::ObjectGroupNotFound, - LoadAlertNotFound); + void enable_alert (in PortableGroup::Location the_location) + raises (LoadAlertNotFound); // Inform member at given location that load alert condition has // passed. - void disable_alert (in PortableGroup::ObjectGroup object_group, - in PortableGroup::Location the_location) - raises (PortableGroup::ObjectGroupNotFound, - LoadAlertNotFound); + void disable_alert (in PortableGroup::Location the_location) + raises (LoadAlertNotFound); // Register a LoadAlert object for the member at the given // location. - void register_load_alert (in PortableGroup::ObjectGroup object_group, - in PortableGroup::Location the_location, + void register_load_alert (in PortableGroup::Location the_location, in LoadAlert load_alert) - raises (PortableGroup::ObjectGroupNotFound, - LoadAlertAlreadyPresent, + raises (LoadAlertAlreadyPresent, LoadAlertNotAdded); // Retrieve the LoadAlert object for the member at the given // location. - LoadAlert get_load_alert (in PortableGroup::ObjectGroup object_group, - in PortableGroup::Location the_location) - raises (PortableGroup::ObjectGroupNotFound, - LoadAlertNotFound); + LoadAlert get_load_alert (in PortableGroup::Location the_location) + raises (LoadAlertNotFound); // Remove (de-register) the LoadAlert object for the member at the // given location. - void remove_load_alert (in PortableGroup::ObjectGroup object_group, - in PortableGroup::Location the_location) - raises (PortableGroup::ObjectGroupNotFound, - LoadAlertNotFound); + void remove_load_alert (in PortableGroup::Location the_location) + raises (LoadAlertNotFound); // The following load monitor methods are only used for the PULL // load monitoring style. diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_CPU_Monitor.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_CPU_Monitor.cpp index b614361e79c..1dbea1b2b54 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_CPU_Monitor.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_CPU_Monitor.cpp @@ -45,6 +45,10 @@ TAO_LB_CPU_Monitor::TAO_LB_CPU_Monitor (const char * location_id, } } +TAO_LB_CPU_Monitor::~TAO_LB_CPU_Monitor (void) +{ +} + CosLoadBalancing::Location * TAO_LB_CPU_Monitor::the_location (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_CPU_Monitor.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_CPU_Monitor.h index def5a5fa6a1..57c5c5d5032 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_CPU_Monitor.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_CPU_Monitor.h @@ -39,7 +39,8 @@ * of 1.25 (i.e. 5/4), and so on and so forth. */ class TAO_LoadBalancing_Export TAO_LB_CPU_Monitor - : public virtual POA_CosLoadBalancing::LoadMonitor + : public virtual POA_CosLoadBalancing::LoadMonitor, + public virtual PortableServer::RefCountServantBase { public: @@ -79,6 +80,15 @@ public: //@} +protected: + + /// Destructor + /** + * Protected destructor to enforce proper memory management through + * reference counting. + */ + ~TAO_LB_CPU_Monitor (void); + private: /// The name of the location at which this LoadMonitor resides. diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Component.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Component.cpp index 456a04ee487..0e3bc923079 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Component.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Component.cpp @@ -31,9 +31,6 @@ TAO_LB_Component::init (int argc, ACE_TCHAR * argv[]) for (int i = 0; i < argc; ++i) { - if ((argc - i) < 6) - return -1; // Not enough arguments. - if (ACE_OS::strcasecmp (argv[i], "-LBGroup") == 0) { const CORBA::ULong j = len; diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Component.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Component.h index e63fb6e73a5..264147d77dd 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Component.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Component.h @@ -29,8 +29,8 @@ /** * @class TAO_LB_Component * - * @brief Implementation of the PortableInterceptor::Component - * interface. + * @brief Service_Object that can be used to add load balancer support + * to a CORBA-base server. * * Servers wishing to transparently add load balancing/management * support load this object via the ACE_Service_Configurator (e.g. by diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_IORInterceptor.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_IORInterceptor.cpp index 29870e2f9fa..78eb712c0af 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_IORInterceptor.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_IORInterceptor.cpp @@ -2,6 +2,9 @@ #include "LB_ObjectReferenceFactory.h" #include "LB_LoadAlert.h" +#include "tao/debug.h" + + ACE_RCSID (LoadBalancing, LB_IORInterceptor, "$Id$") @@ -19,7 +22,9 @@ TAO_LB_IORInterceptor::TAO_LB_IORInterceptor ( location_ (location), lm_ (CosLoadBalancing::LoadManager::_duplicate (lm)), orb_id_ (CORBA::string_dup (orb_id)), - load_alert_ (load_alert) + load_alert_ (load_alert), + la_ref_ (), + lock_ () { } @@ -65,19 +70,6 @@ TAO_LB_IORInterceptor::components_established ( info->current_factory (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; - // This is slightly evil. We're creating an object reference - // through a POA that hasn't completed construction! This can't be - // portable. :( - // - // Note that this components_established() method is only called - // once. This means that there is no chance of the below _this() - // call causing the load balancer's swapped-in - // ObjectReferenceFactory from being used to create the object - // reference. - CosLoadBalancing::LoadAlert_var la = - this->load_alert_._this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - PortableInterceptor::ObjectReferenceFactory * tmp; ACE_NEW_THROW_EX (tmp, TAO_LB_ObjectReferenceFactory (old_orf.in (), @@ -85,8 +77,7 @@ TAO_LB_IORInterceptor::components_established ( this->repository_ids_, this->location_.in (), orb.in (), - this->lm_.in (), - la.in ()), + this->lm_.in ()), CORBA::NO_MEMORY ( CORBA_SystemException::_tao_minor_code ( TAO_DEFAULT_MINOR_CODE, @@ -104,17 +95,73 @@ TAO_LB_IORInterceptor::components_established ( void TAO_LB_IORInterceptor::adapter_manager_state_changed ( PortableInterceptor::AdapterManagerId, - PortableInterceptor::AdapterState - ACE_ENV_ARG_DECL_NOT_USED) + PortableInterceptor::AdapterState state + ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { + if (state == PortableInterceptor::ACTIVE) + { + this->register_load_alert (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } } void -TAO_LB_IORInterceptor:: adapter_state_changed ( +TAO_LB_IORInterceptor::adapter_state_changed ( const PortableInterceptor::ObjectReferenceTemplateSeq &, - PortableInterceptor::AdapterState - ACE_ENV_ARG_DECL_NOT_USED) + PortableInterceptor::AdapterState state + ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { + 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) +{ + { + 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; } diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_IORInterceptor.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_IORInterceptor.h index cf3f749d89e..7043ff19be8 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_IORInterceptor.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_IORInterceptor.h @@ -108,6 +108,11 @@ public: private: + /// Create and register the LoadAlert object with the LoadManager. + void register_load_alert (ACE_ENV_SINGLE_ARG_DECL); + +private: + /// List of stringified object group references. const CORBA::StringSeq object_groups_; @@ -127,6 +132,12 @@ private: /// Reference to the LoadAlert servant. TAO_LB_LoadAlert & load_alert_; + /// Reference to the LoadAlert object. + CosLoadBalancing::LoadAlert_var la_ref_; + + /// Synchronize access to the class state. + TAO_SYNCH_MUTEX lock_; + }; #if defined(_MSC_VER) && (_MSC_VER >= 1200) diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LeastLoaded.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LeastLoaded.cpp index 34514e3006d..c709ce0e6be 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LeastLoaded.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LeastLoaded.cpp @@ -244,16 +244,14 @@ TAO_LB_LeastLoaded::get_location ( // throughput since the LoadAlert object need not be alerted // synchronously. In particular, the load alert can and // should be performed in parallel to the member selection. - load_manager->enable_alert (object_group, - loc + load_manager->enable_alert (loc ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); } else if (load.value <= this->critical_threshold_) { // The location is not overloaded - load_manager->disable_alert (object_group, - loc + load_manager->disable_alert (loc ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); } diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadAlert.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadAlert.cpp index 1f230d85695..a4374826e49 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadAlert.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadAlert.cpp @@ -19,8 +19,7 @@ TAO_LB_LoadAlert::TAO_LB_LoadAlert (void) // } void -TAO_LB_LoadAlert::enable_alert (CORBA::Object_ptr /* object_group */ - ACE_ENV_ARG_DECL_NOT_USED) +TAO_LB_LoadAlert::enable_alert (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException)) { this->alerted_ = 1; diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadAlert.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadAlert.h index 954a3bfc50a..b7b83230c43 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadAlert.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadAlert.h @@ -42,8 +42,7 @@ public: /// Forward requests back to the load manager via the object group /// reference. - virtual void enable_alert (CORBA::Object_ptr object_group - ACE_ENV_ARG_DECL_WITH_DEFAULTS) + virtual void enable_alert (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); /// Stop forwarding requests, and begin accepting them again. diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadAlertInfo.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadAlertInfo.cpp index 48dc8296aa8..78eeeb187f6 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadAlertInfo.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadAlertInfo.cpp @@ -7,30 +7,6 @@ ACE_RCSID (LoadBalancing, TAO_LB_LoadAlertInfo::TAO_LB_LoadAlertInfo (void) : load_alert (), - location (), alerted (0) { } - -int -TAO_LB_LoadAlertInfo::operator== (const TAO_LB_LoadAlertInfo & rhs) -{ - // For the purposes of the LoadAlert info set, only the location is - // important. - return this->location == rhs.location; -} - - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - -template class ACE_Node<TAO_LB_LoadAlertInfo>; -template class ACE_Unbounded_Set<TAO_LB_LoadAlertInfo>; -template class ACE_Unbounded_Set_Iterator<TAO_LB_LoadAlertInfo>; - -#elif defined(ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -#pragma instantiate ACE_Node<TAO_LB_LoadAlertInfo> -#pragma instantiate ACE_Unbounded_Set<TAO_LB_LoadAlertInfo> -#pragma instantiate ACE_Unbounded_Set_Iterator<TAO_LB_LoadAlertInfo> - -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadAlertInfo.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadAlertInfo.h index 93a7ae4b9f6..49f042af84c 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadAlertInfo.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadAlertInfo.h @@ -40,28 +40,13 @@ struct TAO_LB_LoadAlertInfo /// Reference to the LoadAlert object. CosLoadBalancing::LoadAlert_var load_alert; - /// The location at which the member resides. - PortableGroup::Location location; - /// True if the LoadAlert object has been alerted about a given load /// condition. False otherwise. CORBA::Boolean alerted; - /// Equality operator. - /** - * For the purposes of the LoadAlert info set, only the location is - * important. In particular, if a LoadAlert object already resides - * at the given location for a particular object group, this - * equality operator will return true. - */ - int operator== (const TAO_LB_LoadAlertInfo & rhs); - }; -typedef ACE_Unbounded_Set<TAO_LB_LoadAlertInfo> TAO_LB_LoadAlertInfoSet; - - #include "ace/post.h" #endif /* TAO_LB_LOAD_ALERT_INFO_H */ diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadAlertMap.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadAlertMap.cpp index 878de1e4d2f..a1554b35c8a 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadAlertMap.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadAlertMap.cpp @@ -10,18 +10,18 @@ ACE_RCSID (LoadBalancing, #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Hash_Map_Entry<ACE_UINT32, TAO_LB_LoadAlertInfoSet>; -template class ACE_Hash_Map_Manager_Ex<ACE_UINT32, TAO_LB_LoadAlertInfoSet, ACE_Hash<ACE_UINT32>, ACE_Equal_To<ACE_UINT32>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Base_Ex<ACE_UINT32, TAO_LB_LoadAlertInfoSet, ACE_Hash<ACE_UINT32>, ACE_Equal_To<ACE_UINT32>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Ex<ACE_UINT32, TAO_LB_LoadAlertInfoSet, ACE_Hash<ACE_UINT32>, ACE_Equal_To<ACE_UINT32>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Reverse_Iterator_Ex<ACE_UINT32, TAO_LB_LoadAlertInfoSet, ACE_Hash<ACE_UINT32>, ACE_Equal_To<ACE_UINT32>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Entry<PortableGroup::Location, TAO_LB_LoadAlertInfo>; +template class ACE_Hash_Map_Manager_Ex<PortableGroup::Location, TAO_LB_LoadAlertInfo, TAO_PG_Location_Hash, TAO_PG_Location_Equal_To, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Base_Ex<PortableGroup::Location, TAO_LB_LoadAlertInfo, TAO_PG_Location_Hash, TAO_PG_Location_Equal_To, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Ex<PortableGroup::Location, TAO_LB_LoadAlertInfo, TAO_PG_Location_Hash, TAO_PG_Location_Equal_To, ACE_Null_Mutex>; +template class ACE_Hash_Map_Reverse_Iterator_Ex<PortableGroup::Location, TAO_LB_LoadAlertInfo, TAO_PG_Location_Hash, TAO_PG_Location_Equal_To, ACE_Null_Mutex>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Hash_Map_Entry<ACE_UINT32, TAO_LB_LoadAlertInfoSet> -#pragma instantiate ACE_Hash_Map_Manager_Ex<ACE_UINT32, TAO_LB_LoadAlertInfoSet, ACE_Hash<ACE_UINT32>, ACE_Equal_To<ACE_UINT32>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ACE_UINT32, TAO_LB_LoadAlertInfoSet, ACE_Hash<ACE_UINT32>, ACE_Equal_To<ACE_UINT32>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Ex<ACE_UINT32, TAO_LB_LoadAlertInfoSet, ACE_Hash<ACE_UINT32>, ACE_Equal_To<ACE_UINT32>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<ACE_UINT32, TAO_LB_LoadAlertInfoSet, ACE_Hash<ACE_UINT32>, ACE_Equal_To<ACE_UINT32>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Entry<PortableGroup::Location, TAO_LB_LoadAlertInfo> +#pragma instantiate ACE_Hash_Map_Manager_Ex<PortableGroup::Location, TAO_LB_LoadAlertInfo, TAO_PG_Location_Hash, TAO_PG_Location_Equal_To, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<PortableGroup::Location, TAO_LB_LoadAlertInfo, TAO_PG_Location_Hash, TAO_PG_Location_Equal_To, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Iterator_Ex<PortableGroup::Location, TAO_LB_LoadAlertInfo, TAO_PG_Location_Hash, TAO_PG_Location_Equal_To, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<PortableGroup::Location, TAO_LB_LoadAlertInfo, TAO_PG_Location_Hash, TAO_PG_Location_Equal_To, ACE_Null_Mutex> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadAlertMap.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadAlertMap.h index 79e2e6bac53..58eb2ccb932 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadAlertMap.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadAlertMap.h @@ -24,18 +24,18 @@ #include "LB_LoadAlertInfo.h" -#include "tao/PortableServer/Key_Adapters.h" -#include "tao/PortableServer/PortableServerC.h" +#include "orbsvcs/PortableGroup/PG_Location_Hash.h" +#include "orbsvcs/PortableGroup/PG_Location_Equal_To.h" #include "ace/Hash_Map_Manager_T.h" /// LoadAlertInfo hash map typedef. typedef ACE_Hash_Map_Manager_Ex< - ACE_UINT32, - TAO_LB_LoadAlertInfoSet, - ACE_Hash<ACE_UINT32>, - ACE_Equal_To<ACE_UINT32>, + PortableGroup::Location, + TAO_LB_LoadAlertInfo, + TAO_PG_Location_Hash, + TAO_PG_Location_Equal_To, ACE_Null_Mutex> TAO_LB_LoadAlertMap; diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadManager.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadManager.cpp index 30dfce0a6e3..615f947bf7e 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadManager.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadManager.cpp @@ -27,7 +27,7 @@ TAO_LB_LoadManager::TAO_LB_LoadManager (void) lock_ (), monitor_map_ (TAO_PG_MAX_LOCATIONS), load_map_ (TAO_PG_MAX_LOCATIONS), - load_alert_map_ (TAO_PG_MAX_OBJECT_GROUPS), + load_alert_map_ (TAO_PG_MAX_LOCATIONS), object_group_manager_ (), property_manager_ (object_group_manager_), generic_factory_ (object_group_manager_, property_manager_), @@ -105,237 +105,136 @@ TAO_LB_LoadManager::get_loads (const PortableGroup::Location & the_location } void -TAO_LB_LoadManager::enable_alert (PortableGroup::ObjectGroup_ptr object_group, - const PortableGroup::Location & the_location +TAO_LB_LoadManager::enable_alert (const PortableGroup::Location & the_location ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((PortableGroup::ObjectGroupNotFound, - CosLoadBalancing::LoadAlertNotFound)) + ACE_THROW_SPEC ((CosLoadBalancing::LoadAlertNotFound)) { ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->load_alert_lock_); - // TAO's PortableGroup library only uses the lower 32 bits of the - // ObjectGroupId, so this cast is safe. - ACE_UINT32 group_id = - ACE_static_cast (ACE_UINT32, - this->get_object_group_id (object_group - ACE_ENV_ARG_PARAMETER)); - ACE_CHECK; - TAO_LB_LoadAlertMap::ENTRY * entry; - if (this->load_alert_map_.find (group_id, entry) == 0) + if (this->load_alert_map_.find (the_location, entry) == 0) { - // A LoadAlert list for the given ObjectGroup exists. Find the - // reference to the LoadAlert object residing at the given - // location. - TAO_LB_LoadAlertInfoSet & alert_set = entry->int_id_; - - TAO_LB_LoadAlertInfoSet::iterator end = - alert_set.end (); - - for (TAO_LB_LoadAlertInfoSet::iterator i = alert_set.begin (); - i != end; - ++i) - { - if ((*i).location == the_location) - { - // Duplicate before releasing the LoadAlertMap lock to - // prevent a race condition from occuring. The - // LoadAlertInfoSet may be altered prior to invoking an - // operation on the LoadAlert object. - CosLoadBalancing::LoadAlert_var load_alert = - CosLoadBalancing::LoadAlert::_duplicate ( - (*i).load_alert.in ()); - - // The alert condition will be enabled. - // @note There is a subtle problem here. If the below - // remote invocation fails, this variable will be - // incorrectly to "true." - (*i).alerted = 1; - - // Release the lock prior to making the below remote - // invocation. - ACE_Reverse_Lock<TAO_SYNCH_MUTEX> reverse_lock ( - this->load_alert_lock_); - ACE_GUARD (ACE_Reverse_Lock<TAO_SYNCH_MUTEX>, - reverse_guard, - reverse_lock); - - // Use AMI to make the following operation - // "non-blocking," allowing the caller to continue - // without being forced to wait for a response. - load_alert->sendc_enable_alert (this->load_alert_handler_.in (), - object_group - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - return; - } - } - - ACE_THROW (CosLoadBalancing::LoadAlertNotFound ()); + TAO_LB_LoadAlertInfo & info = entry->int_id_; + + // @note This could be problematic if the LoadAlert object is + // registered with more than LoadManager. + if (info.alerted == 1) + return; // No need to set the alert status. It has already + // been set. + + // Duplicate before releasing the LoadAlertMap lock to prevent a + // race condition from occuring. The LoadAlertInfo map may be + // altered prior to invoking an operation on the LoadAlert + // object. + CosLoadBalancing::LoadAlert_var load_alert = + CosLoadBalancing::LoadAlert::_duplicate (info.load_alert.in ()); + + // The alert condition will be enabled. + // @note There is a subtle problem here. If the below + // remote invocation fails, this variable will be + // incorrectly set to "true." + info.alerted = 1; + + // Release the lock prior to making the below remote invocation. + ACE_Reverse_Lock<TAO_SYNCH_MUTEX> reverse_lock (this->load_alert_lock_); + ACE_GUARD (ACE_Reverse_Lock<TAO_SYNCH_MUTEX>, + reverse_guard, + reverse_lock); + + // Use AMI to make the following operation + // "non-blocking," allowing the caller to continue + // without being forced to wait for a response. + load_alert->sendc_enable_alert (this->load_alert_handler_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; } else - { - ACE_THROW (PortableGroup::ObjectGroupNotFound ()); - } + ACE_THROW (CosLoadBalancing::LoadAlertNotFound ()); } void -TAO_LB_LoadManager::disable_alert (PortableGroup::ObjectGroup_ptr object_group, - const PortableGroup::Location & the_location +TAO_LB_LoadManager::disable_alert (const PortableGroup::Location & the_location ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((PortableGroup::ObjectGroupNotFound, - CosLoadBalancing::LoadAlertNotFound)) + ACE_THROW_SPEC ((CosLoadBalancing::LoadAlertNotFound)) { ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->load_alert_lock_); - // TAO's PortableGroup library only uses the lower 32 bits of the - // ObjectGroupId, so this cast is safe. - ACE_UINT32 group_id = - ACE_static_cast (ACE_UINT32, - this->get_object_group_id (object_group - ACE_ENV_ARG_PARAMETER)); - ACE_CHECK; - TAO_LB_LoadAlertMap::ENTRY * entry; - if (this->load_alert_map_.find (group_id, entry) == 0) + if (this->load_alert_map_.find (the_location, entry) == 0) { - // A LoadAlert list for the given ObjectGroup exists. Find the - // reference to the LoadAlert object residing at the given - // location. - TAO_LB_LoadAlertInfoSet & alert_set = entry->int_id_; - - TAO_LB_LoadAlertInfoSet::iterator end = - alert_set.end (); - - for (TAO_LB_LoadAlertInfoSet::iterator i = alert_set.begin (); - i != end; - ++i) - { - // Only perform a remote invocation if the LoadAlert object - // was previously alerted. - if ((*i).location == the_location && (*i).alerted) - { - // Duplicate before releasing the LoadAlertMap lock to - // prevent a race condition on the iterator from - // occuring. The LoadAlertInfoSet may be altered prior - // to invoking an operation on the LoadAlert object. - CosLoadBalancing::LoadAlert_var load_alert = - CosLoadBalancing::LoadAlert::_duplicate ( - (*i).load_alert.in ()); - - // @note There is a subtle problem here. If the below - // remote invocation fails, this variable will be - // incorrectly to "false." - (*i).alerted = 0; // The alert condition will be disabled. - - // Release the lock prior to making the below remote - // invocation. - ACE_Reverse_Lock<TAO_SYNCH_MUTEX> reverse_lock ( - this->load_alert_lock_); - ACE_GUARD (ACE_Reverse_Lock<TAO_SYNCH_MUTEX>, - reverse_guard, - reverse_lock); - - // Use AMI to make the following operation - // "non-blocking," allowing the caller to continue - // without being forced to wait for a response. - load_alert->sendc_disable_alert (this->load_alert_handler_.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - return; - } - } - - ACE_THROW (CosLoadBalancing::LoadAlertNotFound ()); + TAO_LB_LoadAlertInfo & info = entry->int_id_; + + // @note This could be problematic if the LoadAlert object is + // registered with more than LoadManager. + if (info.alerted == 0) + return; // No need to set the alert status. It has already + // been set. + + // Duplicate before releasing the LoadAlertMap lock to prevent a + // race condition from occuring. The LoadAlertInfo map may be + // altered prior to invoking an operation on the LoadAlert + // object. + CosLoadBalancing::LoadAlert_var load_alert = + CosLoadBalancing::LoadAlert::_duplicate (info.load_alert.in ()); + + // The alert condition will be disabled. + // @note There is a subtle problem here. If the below + // remote invocation fails, this variable will be + // incorrectly set to "false." + info.alerted = 0; + + // Release the lock prior to making the below remote invocation. + ACE_Reverse_Lock<TAO_SYNCH_MUTEX> reverse_lock (this->load_alert_lock_); + ACE_GUARD (ACE_Reverse_Lock<TAO_SYNCH_MUTEX>, + reverse_guard, + reverse_lock); + + // Use AMI to make the following operation + // "non-blocking," allowing the caller to continue + // without being forced to wait for a response. + load_alert->sendc_disable_alert (this->load_alert_handler_.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; } else - { - ACE_THROW (PortableGroup::ObjectGroupNotFound ()); - } + ACE_THROW (CosLoadBalancing::LoadAlertNotFound ()); } void TAO_LB_LoadManager::register_load_alert ( - PortableGroup::ObjectGroup_ptr object_group, const PortableGroup::Location & the_location, CosLoadBalancing::LoadAlert_ptr load_alert ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, - PortableGroup::ObjectGroupNotFound, CosLoadBalancing::LoadAlertAlreadyPresent, CosLoadBalancing::LoadAlertNotAdded)) { if (CORBA::is_nil (load_alert)) ACE_THROW (CORBA::BAD_PARAM ()); - // @todo Verify that a member of the given object group actually - // exists at "the_location." It doesn't make much sense to - // register a LoadAlert object for a non-existent member. - ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->load_alert_lock_); - // TAO's PortableGroup library only uses the lower 32 bits of the - // ObjectGroupId, so this cast is safe. - ACE_UINT32 group_id = - ACE_static_cast (ACE_UINT32, - this->get_object_group_id (object_group - ACE_ENV_ARG_PARAMETER)); - ACE_CHECK; + TAO_LB_LoadAlertInfo info; + info.load_alert = CosLoadBalancing::LoadAlert::_duplicate (load_alert); - TAO_LB_LoadAlertMap::ENTRY * entry; - if (this->load_alert_map_.find (group_id, entry) == 0) - { - // A LoadAlert list for the given ObjectGroup exists. Verify - // that no LoadAlert object for the member residing at the given - // location exists. - - TAO_LB_LoadAlertInfoSet & alert_set = entry->int_id_; + int result = this->load_alert_map_.bind (the_location, info); - TAO_LB_LoadAlertInfoSet::iterator end = - alert_set.end (); - - for (TAO_LB_LoadAlertInfoSet::iterator i = alert_set.begin (); - i != end; - ++i) - { - if ((*i).location == the_location) - ACE_THROW (CosLoadBalancing::LoadAlertAlreadyPresent ()); - } - - TAO_LB_LoadAlertInfo load_alert_info; - load_alert_info.load_alert = - CosLoadBalancing::LoadAlert::_duplicate (load_alert); - load_alert_info.location = the_location; - - if (alert_set.insert_tail (load_alert_info) != 0) - ACE_THROW (CosLoadBalancing::LoadAlertNotAdded ()); + if (result == 1) + { + ACE_THROW (CosLoadBalancing::LoadAlertAlreadyPresent ()); } - else + else if (result == -1) { - // No LoadAlert list exists for the given ObjectGroup. Create - // one and insert its initial member. - - TAO_LB_LoadAlertInfo load_alert_info; - load_alert_info.load_alert = - CosLoadBalancing::LoadAlert::_duplicate (load_alert); - load_alert_info.location = the_location; - - TAO_LB_LoadAlertInfoSet alert_set; - if (alert_set.insert_tail (load_alert_info) != 0 - || this->load_alert_map_.bind (group_id, alert_set) != 0) - ACE_THROW (CosLoadBalancing::LoadAlertNotAdded ()); + // Problems dude! + ACE_THROW (CosLoadBalancing::LoadAlertNotAdded ()); } } CosLoadBalancing::LoadAlert_ptr TAO_LB_LoadManager::get_load_alert ( - PortableGroup::ObjectGroup_ptr object_group, const PortableGroup::Location & the_location ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, - PortableGroup::ObjectGroupNotFound, CosLoadBalancing::LoadAlertNotFound)) { ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, @@ -343,82 +242,43 @@ TAO_LB_LoadManager::get_load_alert ( this->load_alert_lock_, CosLoadBalancing::LoadAlert::_nil ()); - // TAO's PortableGroup library only uses the lower 32 bits of the - // ObjectGroupId, so this cast is safe. - ACE_UINT32 group_id = - ACE_static_cast (ACE_UINT32, - this->get_object_group_id (object_group - ACE_ENV_ARG_PARAMETER)); - ACE_CHECK_RETURN (CosLoadBalancing::LoadAlert::_nil ()); - TAO_LB_LoadAlertMap::ENTRY * entry; - if (this->load_alert_map_.find (group_id, entry) == 0) + if (this->load_alert_map_.find (the_location, entry) == 0) { - // A LoadAlert list for the given ObjectGroup exists. Find the - // LoadAlert object for the member residing at the given - // location. - - TAO_LB_LoadAlertInfoSet & alert_set = entry->int_id_; - - TAO_LB_LoadAlertInfoSet::iterator end = - alert_set.end (); - - for (TAO_LB_LoadAlertInfoSet::iterator i = alert_set.begin (); - i != end; - ++i) - { - if ((*i).location == the_location) - return - CosLoadBalancing::LoadAlert::_duplicate ((*i).load_alert.in ()); - } + TAO_LB_LoadAlertInfo & info = entry->int_id_; + return + CosLoadBalancing::LoadAlert::_duplicate (info.load_alert.in ()); + } + else + { ACE_THROW_RETURN (CosLoadBalancing::LoadAlertNotFound (), CosLoadBalancing::LoadAlert::_nil ()); } - else - ACE_THROW_RETURN (PortableGroup::ObjectGroupNotFound (), - CosLoadBalancing::LoadAlert::_nil ()); } void TAO_LB_LoadManager::remove_load_alert ( - PortableGroup::ObjectGroup_ptr object_group, const PortableGroup::Location & the_location ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, - PortableGroup::ObjectGroupNotFound, CosLoadBalancing::LoadAlertNotFound)) { - ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->load_alert_lock_); - - // TAO's PortableGroup library only uses the lower 32 bits of the - // ObjectGroupId, so this cast is safe. - ACE_UINT32 group_id = - ACE_static_cast (ACE_UINT32, - this->get_object_group_id (object_group - ACE_ENV_ARG_PARAMETER)); + // Disable the "alert" status on the LoadAlert object since it will + // no longer be associated with the LoadManager. In particular, + // requests should be allowed through once again since there will be + // no way to control the load shedding mechanism once the LoadAlert + // object is no longer under the control of the LoadManager. + this->disable_alert (the_location + ACE_ENV_ARG_PARAMETER); ACE_CHECK; - TAO_LB_LoadAlertMap::ENTRY * entry; - if (this->load_alert_map_.find (group_id, entry) == 0) - { - // A LoadAlert list for the given ObjectGroup exists. Find the - // LoadAlert object for the member residing at the given - // location. - - TAO_LB_LoadAlertInfoSet & alert_set = entry->int_id_; - - TAO_LB_LoadAlertInfo alert_info; - alert_info.location = the_location; - // No need to set the LoadAlert member. It isn't used in - // comparisons. + ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->load_alert_lock_); - if (alert_set.remove (alert_info) != 0) - ACE_THROW (CosLoadBalancing::LoadAlertNotFound ()); + if (this->load_alert_map_.unbind (the_location) != 0) + { + ACE_THROW (CosLoadBalancing::LoadAlertNotFound ()); } - else - ACE_THROW (PortableGroup::ObjectGroupNotFound ()); - } void diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadManager.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadManager.h index 785270edb54..21f7ce14634 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadManager.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadManager.h @@ -71,49 +71,39 @@ public: CosLoadBalancing::LocationNotFound)); /// Inform member at given location of load alert condition. - virtual void enable_alert (PortableGroup::ObjectGroup_ptr object_group, - const PortableGroup::Location & the_location + virtual void enable_alert (const PortableGroup::Location & the_location ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((PortableGroup::ObjectGroupNotFound, - CosLoadBalancing::LoadAlertNotFound)); + ACE_THROW_SPEC ((CosLoadBalancing::LoadAlertNotFound)); /// Inform member at given location that load alert condition has /// passed. - virtual void disable_alert (PortableGroup::ObjectGroup_ptr object_group, - const PortableGroup::Location & the_location + virtual void disable_alert (const PortableGroup::Location & the_location ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((PortableGroup::ObjectGroupNotFound, - CosLoadBalancing::LoadAlertNotFound)); + ACE_THROW_SPEC ((CosLoadBalancing::LoadAlertNotFound)); /// Register a LoadAlert object for the member at the given /// location. virtual void register_load_alert ( - PortableGroup::ObjectGroup_ptr object_group, const PortableGroup::Location & the_location, CosLoadBalancing::LoadAlert_ptr load_alert ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException, - PortableGroup::ObjectGroupNotFound, CosLoadBalancing::LoadAlertAlreadyPresent, CosLoadBalancing::LoadAlertNotAdded)); /// Retrieve the LoadAlert object for the member at the given /// location. virtual CosLoadBalancing::LoadAlert_ptr get_load_alert ( - PortableGroup::ObjectGroup_ptr object_group, const PortableGroup::Location & the_location ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException, - PortableGroup::ObjectGroupNotFound, CosLoadBalancing::LoadAlertNotFound)); /// Remove (de-register) the LoadAlert object for the member at the /// given location. - virtual void remove_load_alert (PortableGroup::ObjectGroup_ptr object_group, - const PortableGroup::Location & the_location + virtual void remove_load_alert (const PortableGroup::Location & the_location ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException, - PortableGroup::ObjectGroupNotFound, CosLoadBalancing::LoadAlertNotFound)); /// Register a load monitor with the load balancer. diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ORBInitializer.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ORBInitializer.h index a243c7b50c5..c59f5b9b6a7 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ORBInitializer.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ORBInitializer.h @@ -16,14 +16,12 @@ #include "ace/pre.h" -#include "LoadBalancing_export.h" +#include "LB_LoadAlert.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "LB_LoadAlert.h" - #include "tao/LocalObject.h" #include "tao/PortableInterceptorC.h" diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectReferenceFactory.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectReferenceFactory.cpp index f60acde7e24..11195f87bb8 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectReferenceFactory.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectReferenceFactory.cpp @@ -20,8 +20,7 @@ TAO_LB_ObjectReferenceFactory::TAO_LB_ObjectReferenceFactory ( const CORBA::StringSeq & repository_ids, const char * location, CORBA::ORB_ptr orb, - CosLoadBalancing::LoadManager_ptr lm, - CosLoadBalancing::LoadAlert_ptr la) + CosLoadBalancing::LoadManager_ptr lm) : old_orf_ (old_orf), object_groups_ (object_groups), repository_ids_ (repository_ids), @@ -30,7 +29,6 @@ TAO_LB_ObjectReferenceFactory::TAO_LB_ObjectReferenceFactory ( fcids_ (), orb_ (CORBA::ORB::_duplicate (orb)), lm_ (CosLoadBalancing::LoadManager::_duplicate (lm)), - load_alert_ (CosLoadBalancing::LoadAlert::_duplicate (la)), registered_members_ (0) { // Claim ownership of the old ObjectReferenceFactory. @@ -117,12 +115,6 @@ TAO_LB_ObjectReferenceFactory::make_object ( { ACE_TRY { - this->lm_->register_load_alert (object_group.in (), - this->location_, - this->load_alert_.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - object_group = this->lm_->add_member (object_group.in (), this->location_, @@ -191,7 +183,20 @@ TAO_LB_ObjectReferenceFactory::find_object_group ( if (ACE_OS::strcasecmp (this->object_groups_[index].in (), "CREATE") == 0) { - const PortableGroup::Criteria criteria; + PortableGroup::Criteria criteria (1); + criteria.length (1); + + PortableGroup::Property & property = criteria[0]; + property.nam.length (1); + + property.nam[0].id = + CORBA::string_dup ("org.omg.PortableGroup.MembershipStyle"); + + // Configure for application-controlled membership. + PortableGroup::MembershipStyleValue msv = + PortableGroup::MEMB_APP_CTRL; + property.val <<= msv; + PortableGroup::GenericFactory::FactoryCreationId_var fcid; group = diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectReferenceFactory.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectReferenceFactory.h index dec95d00a92..59bb6b187fa 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectReferenceFactory.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectReferenceFactory.h @@ -57,8 +57,7 @@ class TAO_LB_ObjectReferenceFactory const CORBA::StringSeq & repository_ids, const char * location, CORBA::ORB_ptr orb, - CosLoadBalancing::LoadManager_ptr lm, - CosLoadBalancing::LoadAlert_ptr la); + CosLoadBalancing::LoadManager_ptr lm); /** * @name PortableInterceptor::ObjectReferenceFactory Methods @@ -155,9 +154,6 @@ private: /// Reference to the LoadManager object. CosLoadBalancing::LoadManager_var lm_; - /// Reference to the LoadAlert object for this location. - CosLoadBalancing::LoadAlert_var load_alert_; - /// Array of flags that denotes whether or not an object group /// member of a given RepositoryId has been registered with the /// LoadManager. diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Pull_Handler.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Pull_Handler.cpp index 460d3b4e22d..eb431a84ade 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Pull_Handler.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Pull_Handler.cpp @@ -60,16 +60,16 @@ TAO_LB_Pull_Handler::handle_timeout ( ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; -// ACE_DEBUG ((LM_DEBUG, -// "LOCATION = %s\tLOAD = %f\n", -// (*i).ext_id_[0].id.in (), -// location->load_list[0].value)); +// ACE_DEBUG ((LM_DEBUG, +// "LOCATION = %s\tLOAD = %f\n", +// location[0].id.in (), +// load_list[0].value)); } } ACE_CATCHANY { // Catch the exception and ignore it. - + if (TAO_debug_level > 0) ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "(%P|%t) PullHandler::handle_timeout()\n"); diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Random.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Random.cpp index 0831b8ce4f4..9038bcced34 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Random.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Random.cpp @@ -18,7 +18,7 @@ TAO_LB_Random::name (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) { return CORBA::string_dup ("Random"); } - + CosLoadBalancing::Properties * TAO_LB_Random::get_properties (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) @@ -35,7 +35,7 @@ TAO_LB_Random::get_properties (ACE_ENV_SINGLE_ARG_DECL) return props; } - + void TAO_LB_Random::push_loads ( const PortableGroup::Location & /* the_location */, @@ -46,7 +46,7 @@ TAO_LB_Random::push_loads ( { ACE_THROW (CosLoadBalancing::StrategyNotAdaptive ()); } - + CORBA::Object_ptr TAO_LB_Random::next_member ( PortableGroup::ObjectGroup_ptr object_group, diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Random.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Random.h index 40617f3503a..f927a277764 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Random.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Random.h @@ -50,18 +50,18 @@ public: //@{ virtual char * name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); - + virtual CosLoadBalancing::Properties * get_properties ( ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); - + virtual void push_loads ( const PortableGroup::Location & the_location, const CosLoadBalancing::LoadList & loads ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException, CosLoadBalancing::StrategyNotAdaptive)); - + virtual CORBA::Object_ptr next_member ( PortableGroup::ObjectGroup_ptr object_group, CosLoadBalancing::LoadManager_ptr load_manager @@ -69,7 +69,7 @@ public: ACE_THROW_SPEC ((CORBA::SystemException, PortableGroup::ObjectGroupNotFound, PortableGroup::MemberNotFound)); - + virtual void analyze_loads ( PortableGroup::ObjectGroup_ptr object_group, CosLoadBalancing::LoadManager_ptr load_manager diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_conf.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_conf.h index 4bacab885b8..0a4147df241 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_conf.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_conf.h @@ -26,13 +26,13 @@ #ifndef TAO_LB_PULL_HANDLER_INTERVAL /// The interval in seconds the load balancer queries registered load /// monitors for loads. -const long TAO_LB_PULL_HANDLER_INTERVAL = 1; +const long TAO_LB_PULL_HANDLER_INTERVAL = 5; #endif /* TAO_LB_PULL_HANDLER_INTERVAL */ #ifndef TAO_LB_PULL_HANDLER_RESTART /// The time in seconds the load balancer's "pull handler" is /// restarted after being fired. -const long TAO_LB_PULL_HANDLER_RESTART = 1; +const long TAO_LB_PULL_HANDLER_RESTART = 5; #endif /* TAO_LB_PULL_HANDLER_RESTART */ diff --git a/TAO/orbsvcs/orbsvcs/Makefile.CosLoadBalancing b/TAO/orbsvcs/orbsvcs/Makefile.CosLoadBalancing index 971bd9f7924..a8a47800c50 100644 --- a/TAO/orbsvcs/orbsvcs/Makefile.CosLoadBalancing +++ b/TAO/orbsvcs/orbsvcs/Makefile.CosLoadBalancing @@ -1346,26 +1346,11 @@ realclean: clean $(TAO_ROOT)/tao/GIOPC.i \ PortableGroupC.i \ CosLoadBalancingC.i \ - $(TAO_ROOT)/tao/PortableServer/Key_Adapters.h \ - $(TAO_ROOT)/tao/PortableServer/PortableServerC.h \ - $(TAO_ROOT)/tao/PortableServer/portableserver_export.h \ - $(TAO_ROOT)/tao/PortableServer/PortableServerC.i \ - $(ACE_ROOT)/ace/Map_T.h \ - $(ACE_ROOT)/ace/Pair_T.h \ - $(ACE_ROOT)/ace/Pair_T.i \ - $(ACE_ROOT)/ace/Pair_T.cpp \ - $(ACE_ROOT)/ace/Map_Manager.h \ - $(ACE_ROOT)/ace/Map_Manager.i \ - $(ACE_ROOT)/ace/Map_Manager.cpp \ - $(ACE_ROOT)/ace/Hash_Map_Manager.h \ - $(ACE_ROOT)/ace/Active_Map_Manager.h \ - $(ACE_ROOT)/ace/Active_Map_Manager.i \ - $(ACE_ROOT)/ace/Active_Map_Manager_T.h \ - $(ACE_ROOT)/ace/Active_Map_Manager_T.i \ - $(ACE_ROOT)/ace/Active_Map_Manager_T.cpp \ - $(ACE_ROOT)/ace/Map_T.i \ - $(ACE_ROOT)/ace/Map_T.cpp \ - $(TAO_ROOT)/tao/PortableServer/Key_Adapters.i + PortableGroup/PG_Location_Hash.h \ + PortableGroup/PG_Location_Hash.inl \ + PortableGroup/PG_Location_Equal_To.h \ + PortableGroup/PG_Operators.h \ + PortableGroup/PG_Location_Equal_To.inl .obj/LB_LoadAlert_Handler.o .obj/LB_LoadAlert_Handler.so .shobj/LB_LoadAlert_Handler.o .shobj/LB_LoadAlert_Handler.so: LoadBalancing/LB_LoadAlert_Handler.cpp \ LoadBalancing/LB_LoadAlert_Handler.h \ @@ -2358,6 +2343,24 @@ realclean: clean CosLoadBalancingS_T.cpp \ CosLoadBalancingS.i \ LoadBalancing/LB_LoadAlertMap.h LoadBalancing/LB_LoadAlertInfo.h \ + PortableGroup/PG_Location_Hash.h \ + PortableGroup/PG_Location_Hash.inl \ + PortableGroup/PG_Location_Equal_To.h \ + PortableGroup/PG_Operators.h \ + PortableGroup/PG_Location_Equal_To.inl \ + LoadBalancing/LB_MonitorMap.h LoadBalancing/LB_LoadListMap.h \ + LoadBalancing/LB_Pull_Handler.h \ + PortableGroup/PG_PropertyManager.h \ + PortableGroup/PG_Default_Property_Validator.h \ + PortableGroup/PG_GenericFactory.h \ + PortableGroup/PG_Factory_Map.h \ + PortableGroup/PG_Factory_Set.h \ + $(ACE_ROOT)/ace/Array_Base.h \ + $(ACE_ROOT)/ace/Array_Base.inl \ + $(ACE_ROOT)/ace/Array_Base.cpp \ + PortableGroup/PG_ObjectGroupManager.h \ + PortableGroup/PG_ObjectGroup_Map.h \ + PortableGroup/PG_MemberInfo.h \ $(TAO_ROOT)/tao/PortableServer/Key_Adapters.h \ $(ACE_ROOT)/ace/Map_T.h \ $(ACE_ROOT)/ace/Pair_T.h \ @@ -2375,24 +2378,6 @@ realclean: clean $(ACE_ROOT)/ace/Map_T.i \ $(ACE_ROOT)/ace/Map_T.cpp \ $(TAO_ROOT)/tao/PortableServer/Key_Adapters.i \ - LoadBalancing/LB_MonitorMap.h \ - PortableGroup/PG_Location_Hash.h \ - PortableGroup/PG_Location_Hash.inl \ - PortableGroup/PG_Location_Equal_To.h \ - PortableGroup/PG_Operators.h \ - PortableGroup/PG_Location_Equal_To.inl \ - LoadBalancing/LB_LoadListMap.h LoadBalancing/LB_Pull_Handler.h \ - PortableGroup/PG_PropertyManager.h \ - PortableGroup/PG_Default_Property_Validator.h \ - PortableGroup/PG_GenericFactory.h \ - PortableGroup/PG_Factory_Map.h \ - PortableGroup/PG_Factory_Set.h \ - $(ACE_ROOT)/ace/Array_Base.h \ - $(ACE_ROOT)/ace/Array_Base.inl \ - $(ACE_ROOT)/ace/Array_Base.cpp \ - PortableGroup/PG_ObjectGroupManager.h \ - PortableGroup/PG_ObjectGroup_Map.h \ - PortableGroup/PG_MemberInfo.h \ PortableGroup/PG_Location_Map.h \ LoadBalancing/LB_MemberLocator.h LoadBalancing/LB_LoadAlert_Handler.h \ LoadBalancing/LB_RoundRobin.h LoadBalancing/LB_LoadMap.h \ @@ -3046,6 +3031,24 @@ realclean: clean CosLoadBalancingS_T.cpp \ CosLoadBalancingS.i \ LoadBalancing/LB_LoadAlertMap.h LoadBalancing/LB_LoadAlertInfo.h \ + PortableGroup/PG_Location_Hash.h \ + PortableGroup/PG_Location_Hash.inl \ + PortableGroup/PG_Location_Equal_To.h \ + PortableGroup/PG_Operators.h \ + PortableGroup/PG_Location_Equal_To.inl \ + LoadBalancing/LB_MonitorMap.h LoadBalancing/LB_LoadListMap.h \ + LoadBalancing/LB_Pull_Handler.h \ + PortableGroup/PG_PropertyManager.h \ + PortableGroup/PG_Default_Property_Validator.h \ + PortableGroup/PG_GenericFactory.h \ + PortableGroup/PG_Factory_Map.h \ + PortableGroup/PG_Factory_Set.h \ + $(ACE_ROOT)/ace/Array_Base.h \ + $(ACE_ROOT)/ace/Array_Base.inl \ + $(ACE_ROOT)/ace/Array_Base.cpp \ + PortableGroup/PG_ObjectGroupManager.h \ + PortableGroup/PG_ObjectGroup_Map.h \ + PortableGroup/PG_MemberInfo.h \ $(TAO_ROOT)/tao/PortableServer/Key_Adapters.h \ $(ACE_ROOT)/ace/Map_T.h \ $(ACE_ROOT)/ace/Pair_T.h \ @@ -3063,24 +3066,6 @@ realclean: clean $(ACE_ROOT)/ace/Map_T.i \ $(ACE_ROOT)/ace/Map_T.cpp \ $(TAO_ROOT)/tao/PortableServer/Key_Adapters.i \ - LoadBalancing/LB_MonitorMap.h \ - PortableGroup/PG_Location_Hash.h \ - PortableGroup/PG_Location_Hash.inl \ - PortableGroup/PG_Location_Equal_To.h \ - PortableGroup/PG_Operators.h \ - PortableGroup/PG_Location_Equal_To.inl \ - LoadBalancing/LB_LoadListMap.h LoadBalancing/LB_Pull_Handler.h \ - PortableGroup/PG_PropertyManager.h \ - PortableGroup/PG_Default_Property_Validator.h \ - PortableGroup/PG_GenericFactory.h \ - PortableGroup/PG_Factory_Map.h \ - PortableGroup/PG_Factory_Set.h \ - $(ACE_ROOT)/ace/Array_Base.h \ - $(ACE_ROOT)/ace/Array_Base.inl \ - $(ACE_ROOT)/ace/Array_Base.cpp \ - PortableGroup/PG_ObjectGroupManager.h \ - PortableGroup/PG_ObjectGroup_Map.h \ - PortableGroup/PG_MemberInfo.h \ PortableGroup/PG_Location_Map.h .obj/LB_MonitorMap.o .obj/LB_MonitorMap.so .shobj/LB_MonitorMap.o .shobj/LB_MonitorMap.so: LoadBalancing/LB_MonitorMap.cpp \ @@ -3733,6 +3718,18 @@ realclean: clean CosLoadBalancingS_T.cpp \ CosLoadBalancingS.i \ LoadBalancing/LB_LoadAlertMap.h LoadBalancing/LB_LoadAlertInfo.h \ + LoadBalancing/LB_LoadListMap.h \ + PortableGroup/PG_PropertyManager.h \ + PortableGroup/PG_Default_Property_Validator.h \ + PortableGroup/PG_GenericFactory.h \ + PortableGroup/PG_Factory_Map.h \ + PortableGroup/PG_Factory_Set.h \ + $(ACE_ROOT)/ace/Array_Base.h \ + $(ACE_ROOT)/ace/Array_Base.inl \ + $(ACE_ROOT)/ace/Array_Base.cpp \ + PortableGroup/PG_ObjectGroupManager.h \ + PortableGroup/PG_ObjectGroup_Map.h \ + PortableGroup/PG_MemberInfo.h \ $(TAO_ROOT)/tao/PortableServer/Key_Adapters.h \ $(ACE_ROOT)/ace/Map_T.h \ $(ACE_ROOT)/ace/Pair_T.h \ @@ -3750,18 +3747,6 @@ realclean: clean $(ACE_ROOT)/ace/Map_T.i \ $(ACE_ROOT)/ace/Map_T.cpp \ $(TAO_ROOT)/tao/PortableServer/Key_Adapters.i \ - LoadBalancing/LB_LoadListMap.h \ - PortableGroup/PG_PropertyManager.h \ - PortableGroup/PG_Default_Property_Validator.h \ - PortableGroup/PG_GenericFactory.h \ - PortableGroup/PG_Factory_Map.h \ - PortableGroup/PG_Factory_Set.h \ - $(ACE_ROOT)/ace/Array_Base.h \ - $(ACE_ROOT)/ace/Array_Base.inl \ - $(ACE_ROOT)/ace/Array_Base.cpp \ - PortableGroup/PG_ObjectGroupManager.h \ - PortableGroup/PG_ObjectGroup_Map.h \ - PortableGroup/PG_MemberInfo.h \ PortableGroup/PG_Location_Map.h \ $(TAO_ROOT)/tao/debug.h @@ -5355,7 +5340,8 @@ realclean: clean CosLoadBalancingS_T.i \ CosLoadBalancingS_T.cpp \ CosLoadBalancingS.i \ - LoadBalancing/LB_LoadAlert.inl + LoadBalancing/LB_LoadAlert.inl \ + $(TAO_ROOT)/tao/debug.h .obj/LB_ObjectReferenceFactory.o .obj/LB_ObjectReferenceFactory.so .shobj/LB_ObjectReferenceFactory.o .shobj/LB_ObjectReferenceFactory.so: \ LoadBalancing/LB_ObjectReferenceFactory.cpp \ @@ -5659,14 +5645,13 @@ realclean: clean .obj/LB_ORBInitializer.o .obj/LB_ORBInitializer.so .shobj/LB_ORBInitializer.o .shobj/LB_ORBInitializer.so: LoadBalancing/LB_ORBInitializer.cpp \ LoadBalancing/LB_ORBInitializer.h $(ACE_ROOT)/ace/pre.h \ - LoadBalancing/LoadBalancing_export.h \ - $(ACE_ROOT)/ace/post.h \ - $(ACE_ROOT)/ace/ace_wchar.h \ - $(ACE_ROOT)/ace/ace_wchar.inl \ LoadBalancing/LB_LoadAlert.h \ CosLoadBalancingS.h \ $(TAO_ROOT)/tao/Messaging/MessagingS.h \ $(TAO_ROOT)/tao/Messaging/messaging_export.h \ + $(ACE_ROOT)/ace/post.h \ + $(ACE_ROOT)/ace/ace_wchar.h \ + $(ACE_ROOT)/ace/ace_wchar.inl \ $(TAO_ROOT)/tao/Messaging/Messaging.h \ $(TAO_ROOT)/tao/Messaging/MessagingC.h \ $(TAO_ROOT)/tao/orbconf.h \ @@ -6290,8 +6275,7 @@ realclean: clean $(TAO_ROOT)/tao/Asynch_Invocation.i \ $(TAO_ROOT)/tao/Messaging/Twoway_Asynch_Invocation.i \ LB_ORTC.i \ - LoadBalancing/LB_ORBInitializer.h \ - LoadBalancing/LoadBalancing_export.h LoadBalancing/LB_LoadAlert.h \ + LoadBalancing/LB_ORBInitializer.h LoadBalancing/LB_LoadAlert.h \ CosLoadBalancingS.h \ $(TAO_ROOT)/tao/Messaging/MessagingS.h \ $(TAO_ROOT)/tao/PortableServer/PolicyS.h \ diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.cpp index c13431c2df7..817946d0a9d 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.cpp @@ -91,13 +91,15 @@ TAO_PG_GenericFactory::create_object ( ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (CORBA::Object::_nil ()); - CORBA::ULong factory_infos_count = factory_infos->length (); + CORBA::ULong factory_infos_count = + (factory_infos == 0 ? 0 : factory_infos->length ()); // If the number of factories is less than the initial number of // members, then the desired number of members cannot possibly be // created. - if (factory_infos_count < ACE_static_cast (CORBA::ULong, - initial_number_members)) + if (factory_infos != 0 + && factory_infos_count < ACE_static_cast (CORBA::ULong, + initial_number_members)) ACE_THROW_RETURN (PortableGroup::CannotMeetCriteria (), CORBA::Object::_nil ()); @@ -447,7 +449,7 @@ TAO_PG_GenericFactory::process_criteria ( const char * type_id, const PortableGroup::Criteria & criteria, PortableGroup::MembershipStyleValue & membership_style, - PortableGroup::FactoriesValue * factory_infos, + PortableGroup::FactoriesValue *& factory_infos, PortableGroup::InitialNumberMembersValue & initial_number_members, PortableGroup::MinimumNumberMembersValue & minimum_number_members ACE_ENV_ARG_DECL) diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.h index 5bc8e314ffb..ce4bd2e6591 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.h @@ -149,7 +149,7 @@ private: const char * type_id, const PortableGroup::Criteria & criteria, PortableGroup::MembershipStyleValue & membership_style, - PortableGroup::FactoriesValue * factory_infos, + PortableGroup::FactoriesValue *& factory_infos, PortableGroup::InitialNumberMembersValue & initial_number_members, PortableGroup::MinimumNumberMembersValue & minimum_number_members ACE_ENV_ARG_DECL); diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_PropertyManager.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_PropertyManager.cpp index 51057169c59..92ffa21365c 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_PropertyManager.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_PropertyManager.cpp @@ -116,7 +116,7 @@ TAO_PG_PropertyManager::set_type_properties ( ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->lock_); - ACE_Hash_Map_Entry<const char *, PortableGroup::Properties> * entry; + Type_Prop_Table::ENTRY * entry; if (this->type_properties_.find (type_id, entry) != 0) ACE_THROW (CORBA::BAD_PARAM ()); @@ -133,14 +133,16 @@ TAO_PG_PropertyManager::get_type_properties ( { ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, this->lock_, 0); - ACE_Hash_Map_Entry<const char *, PortableGroup::Properties> * entry; - if (this->type_properties_.find (type_id, entry) != 0) - ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); - PortableGroup::Properties & type_properties = entry->int_id_; + Type_Prop_Table::ENTRY * entry; + PortableGroup::Properties * type_properties = 0; + + if (this->type_properties_.find (type_id, entry) == 0) + type_properties = &entry->int_id_; const CORBA::ULong def_props_len = this->default_properties_.length (); - const CORBA::ULong type_props_len = type_properties.length (); + const CORBA::ULong type_props_len = + (type_properties == 0 ? 0 : type_properties->length ()); const CORBA::ULong props_len = (def_props_len > type_props_len ? def_props_len : type_props_len); @@ -163,7 +165,9 @@ TAO_PG_PropertyManager::get_type_properties ( properties->length (props_len); *tmp_properties = this->default_properties_; - TAO_PG::override_properties (type_properties, *tmp_properties); + + if (type_properties != 0 && type_props_len > 0) + TAO_PG::override_properties (*type_properties, *tmp_properties); return properties._retn (); } @@ -183,7 +187,7 @@ TAO_PG_PropertyManager::remove_type_properties ( ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->lock_); - ACE_Hash_Map_Entry<const char *, PortableGroup::Properties> * entry; + Type_Prop_Table::ENTRY * entry; if (this->type_properties_.find (type_id, entry) != 0) ACE_THROW (CORBA::BAD_PARAM ()); @@ -248,11 +252,11 @@ TAO_PG_PropertyManager::get_properties ( ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, property_map_guard, this->lock_, 0); // @@ Race condition here! - PortableGroup::Properties_var dynamic_properties = + PortableGroup::Properties_var dynamic_properties = this->object_group_manager_.get_properties (object_group ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); - + CORBA::ULong dyn_props_len = dynamic_properties->length (); if (dyn_props_len > properties_len) properties_len = dyn_props_len; @@ -264,7 +268,7 @@ TAO_PG_PropertyManager::get_properties ( CORBA::ULong type_props_len = 0; PortableGroup::Properties * type_properties = 0; - ACE_Hash_Map_Entry<const char *, PortableGroup::Properties> * type_entry; + Type_Prop_Table::ENTRY * type_entry; if (this->type_properties_.find (type_id.in (), type_entry) == 0) { type_properties = &type_entry->int_id_; @@ -273,7 +277,7 @@ TAO_PG_PropertyManager::get_properties ( if (type_props_len > properties_len) properties_len = type_props_len; } - + CORBA::ULong def_props_len = this->default_properties_.length (); if (def_props_len > properties_len) properties_len = def_props_len; @@ -359,19 +363,19 @@ TAO_PG_PropertyManager::remove_properties ( #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) // Type-specific property hash map template instantiations -template class ACE_Hash_Map_Entry<const char *, PortableGroup::Properties>; -template class ACE_Hash_Map_Manager_Ex<const char *, PortableGroup::Properties, ACE_Hash<const char *>, ACE_Equal_To<const char *>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Base_Ex<const char *, PortableGroup::Properties, ACE_Hash<const char *>, ACE_Equal_To<const char *>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Ex<const char *, PortableGroup::Properties, ACE_Hash<const char *>, ACE_Equal_To<const char *>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Reverse_Iterator_Ex<const char *, PortableGroup::Properties, ACE_Hash<const char *>, ACE_Equal_To<const char *>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Entry<ACE_CString, PortableGroup::Properties>; +template class ACE_Hash_Map_Manager_Ex<ACE_CString, PortableGroup::Properties, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, PortableGroup::Properties, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Ex<ACE_CString, PortableGroup::Properties, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Reverse_Iterator_Ex<ACE_CString, PortableGroup::Properties, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) // Type-specific property hash map template instantiations -#pragma instantiate ACE_Hash_Map_Entry<const char *, PortableGroup::Properties> -#pragma instantiate ACE_Hash_Map_Manager_Ex<const char *, PortableGroup::Properties, ACE_Hash<const char *>, ACE_Equal_To<const char *>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<const char *, PortableGroup::Properties, ACE_Hash<const char *>, ACE_Equal_To<const char *>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Ex<const char *, PortableGroup::Properties, ACE_Hash<const char *>, ACE_Equal_To<const char *>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<const char *, PortableGroup::Properties, ACE_Hash<const char *>, ACE_Equal_To<const char *>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Entry<ACE_CString, PortableGroup::Properties> +#pragma instantiate ACE_Hash_Map_Manager_Ex<ACE_CString, PortableGroup::Properties, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, PortableGroup::Properties, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Iterator_Ex<ACE_CString, PortableGroup::Properties, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<ACE_CString, PortableGroup::Properties, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_PropertyManager.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_PropertyManager.h index f5843005c97..7043389256d 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_PropertyManager.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_PropertyManager.h @@ -145,10 +145,10 @@ public: /// Type-specific property hash map. typedef ACE_Hash_Map_Manager_Ex< - const char *, + ACE_CString, PortableGroup::Properties, - ACE_Hash<const char *>, - ACE_Equal_To<const char *>, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> Type_Prop_Table; private: |