summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOssama Othman <ossama-othman@users.noreply.github.com>2002-07-10 04:37:16 +0000
committerOssama Othman <ossama-othman@users.noreply.github.com>2002-07-10 04:37:16 +0000
commitd2c018ab380e38d4350f67e61f26e608395cd88a (patch)
tree79d1fa3e337e3c479fee00c80b41662f2e4074a5
parent5f68649454a409fc96537a66321b6b65c0c57bef (diff)
downloadATCD-d2c018ab380e38d4350f67e61f26e608395cd88a.tar.gz
*** empty log message ***
-rw-r--r--TAO/orbsvcs/orbsvcs/CosLoadBalancing.idl14
-rw-r--r--TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LeastLoaded.cpp78
-rw-r--r--TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LeastLoaded.h12
-rw-r--r--TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadManager.cpp9
-rw-r--r--TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadManager.h3
5 files changed, 80 insertions, 36 deletions
diff --git a/TAO/orbsvcs/orbsvcs/CosLoadBalancing.idl b/TAO/orbsvcs/orbsvcs/CosLoadBalancing.idl
index 238dfcbf75f..da35b5dd205 100644
--- a/TAO/orbsvcs/orbsvcs/CosLoadBalancing.idl
+++ b/TAO/orbsvcs/orbsvcs/CosLoadBalancing.idl
@@ -81,11 +81,16 @@ module CosLoadBalancing
Properties get_properties ();
- // Report loads at given location to the Strategy.
+ // Report loads at given location to the LoadManager.
void push_loads (in PortableGroup::Location the_location,
in LoadList loads)
- raises (LocationNotFound,
- StrategyNotAdaptive);
+ raises (LocationNotFound);
+
+ // Get loads, if any, at the given location. Load balancing
+ // strategies may use this method to query loads at specific
+ // locations.
+ LoadList get_loads (in PortableGroup::Location the_location)
+ raises (LocationNotFound);
// Return the next member from the given object group which will
// requests will be forward to.
@@ -143,8 +148,7 @@ module CosLoadBalancing
// For the PUSH load monitoring style.
void push_loads (in PortableGroup::Location the_location,
- in LoadList loads)
- raises (StrategyNotAdaptive);
+ in LoadList loads);
// The following load monitor methods are only used for the PULL
// load monitoring style.
diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LeastLoaded.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LeastLoaded.cpp
index 50bf88300d1..6ff77419e3a 100644
--- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LeastLoaded.cpp
+++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LeastLoaded.cpp
@@ -14,8 +14,12 @@ ACE_RCSID (LoadBalancing,
#endif /* defined INLINE */
-TAO_LB_LeastLoaded::TAO_LB_LeastLoaded (void)
- : load_map_ (TAO_PG_MAX_LOCATIONS),
+TAO_LB_LeastLoaded::TAO_LB_LeastLoaded (CORBA::Float critical_threshold,
+ CORBA::Float reject_threshold,
+ CORBA::Float tolerance,
+ CORBA::Float dampening,
+ CORBA::Float per_balance_load)
+ : load_map_ (0),
lock_ (),
critical_threshold_ (0),
reject_threshold_ (0),
@@ -23,10 +27,16 @@ TAO_LB_LeastLoaded::TAO_LB_LeastLoaded (void)
dampening_ (0),
per_balance_load_ (0)
{
+ // A load map that retains previous load values at a given location
+ // is only needed if dampening is enabled, i.e. non-zero.
+ if (this->dampening_ != 0)
+ ACE_NEW (this->load_map_,
+ LoadMap (TAO_PG_MAX_LOCATIONS));
}
TAO_LB_LeastLoaded::~TAO_LB_LeastLoaded (void)
{
+ delete this->load_map_;
}
char *
@@ -58,8 +68,7 @@ TAO_LB_LeastLoaded::push_loads (
const PortableGroup::Location & the_location,
const CosLoadBalancing::LoadList & loads
ACE_ENV_ARG_DECL)
- ACE_THROW_SPEC ((CORBA::SystemException,
- CosLoadBalancing::StrategyNotAdaptive))
+ ACE_THROW_SPEC ((CORBA::SystemException))
{
// Only the first load is used by this load balancing strategy.
if (loads.length () == 0)
@@ -67,33 +76,37 @@ TAO_LB_LeastLoaded::push_loads (
const CosLoadBalancing::Load & new_load = loads[0];
- TAO_LB_LoadMap::ENTRY * load;
- if (this->load_map_.find (the_location, load) == 0)
+ if (this->load_map_ != 0)
{
- CosLoadBalancing::Load & previous_load = load->int_id_;
+ TAO_LB_LoadMap::ENTRY * load;
+ if (this->load_map_->find (the_location, load) == 0)
+ {
+ CosLoadBalancing::Load & previous_load = load->int_id_;
- if (previous_load.id != new_load.id)
- ACE_THROW (CORBA::BAD_PARAM ()); // Somebody switched LoadIds
- // on us!
+ if (previous_load.id != new_load.id)
+ ACE_THROW (CORBA::BAD_PARAM ()); // Somebody switched
+ // LoadIds on us!
- previous_load.value =
- this->effective_load (previous_load.value, new_load.value);
- }
- else
- {
- const CosLoadBalancing::Load eff_load =
+ previous_load.value =
+ this->effective_load (previous_load.value, new_load.value);
+ }
+ else
{
- new_load.id,
- this->effective_load (0, new_load.value);
- };
+ const CosLoadBalancing::Load eff_load =
+ {
+ new_load.id,
+ this->effective_load (0, new_load.value);
+ };
- if (this->load_map_.bind (the_location, eff_load) != 0)
- {
- if (TAO_debug_level > 0)
- ACE_ERROR ((LM_ERROR,
- "ERROR: TAO_LB_LeastLoaded - Unable to push loads\n"));
+ if (this->load_map_->bind (the_location, eff_load) != 0)
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR ((LM_ERROR,
+ "ERROR: TAO_LB_LeastLoaded - "
+ "Unable to push loads\n"));
- ACE_THROW (CORBA::INTERNAL ());
+ ACE_THROW (CORBA::INTERNAL ());
+ }
}
}
}
@@ -224,6 +237,7 @@ TAO_LB_LeastLoaded::analyze_loads (
CORBA::Boolean
TAO_LB_LeastLoaded::get_location (
+ const CosLoadBalancing::LoadManager_ptr load_manager,
const PortableGroup::Locations & locations,
PortableGroup::Location & location)
{
@@ -241,6 +255,20 @@ TAO_LB_LeastLoaded::get_location (
for (CORBA::ULong i = 0; i < len; ++i)
{
+ const PortableGroup::Location & loc = locations[i];
+
+ // Retrieve the load list for the location from the
+ // LoadManager and push it to this Strategy's load processor.
+ CosLoadBalancing::LoadList_var current_loads =
+ load_manager->get_loads (loc
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ this->push_loads (loc,
+ current_loads.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
// WRONG!!! THIS IS LEAST LOADED, NOT MINIMUM DISPERSION!
LoadMap::ENTRY * entry;
if (this->load_map_.find (locations[i], entry) == 0
diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LeastLoaded.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LeastLoaded.h
index 266244c55d8..fd74cd698d3 100644
--- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LeastLoaded.h
+++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LeastLoaded.h
@@ -63,8 +63,7 @@ public:
const PortableGroup::Location & the_location,
const CosLoadBalancing::LoadList & loads
ACE_ENV_ARG_DECL_WITH_DEFAULTS)
- ACE_THROW_SPEC ((CORBA::SystemException,
- CosLoadBalancing::StrategyNotAdaptive));
+ ACE_THROW_SPEC ((CORBA::SystemException));
virtual CORBA::Object_ptr next_member (
PortableGroup::ObjectGroup_ptr object_group,
@@ -93,6 +92,15 @@ protected:
CORBA::Float effective_load (CORBA::Float previous_load,
CORBA::Float new_load);
+ ///
+ void push_load (
+ const PortableGroup::Location & the_location,
+ const CosLoadBalancing::Load & new_load
+ CosLoadBalancing::Load & effective_load
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+
private:
/// Container that maps location to load list.
diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadManager.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadManager.cpp
index b47a3d92b60..568d2834c52 100644
--- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadManager.cpp
+++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadManager.cpp
@@ -39,9 +39,14 @@ TAO_LB_LoadManager::push_loads (
const PortableGroup::Location & /* the_location */,
const CosLoadBalancing::LoadList & /* loads */
ACE_ENV_ARG_DECL)
- ACE_THROW_SPEC ((CORBA::SystemException,
- CosLoadBalancing::StrategyNotAdaptive))
+ ACE_THROW_SPEC ((CORBA::SystemException))
{
+#if 0
+ // Only the first load is used by this load balancing strategy.
+ if (loads.length () == 0)
+ ACE_THROW (CORBA::BAD_PARAM ());
+#endif /* 0 */
+
ACE_THROW (CORBA::NO_IMPLEMENT ());
}
diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadManager.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadManager.h
index 8ac92176c53..fedce5dd7b8 100644
--- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadManager.h
+++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LoadManager.h
@@ -59,8 +59,7 @@ public:
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));
+ ACE_THROW_SPEC ((CORBA::SystemException));
/// Register a load monitor with the load balancer.
virtual void register_load_monitor (