diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2001-06-20 23:00:26 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2001-06-20 23:00:26 +0000 |
commit | bd1dcd3c460b27d635f5230f26ecfe32eb251fdb (patch) | |
tree | b580c7753f4e1246b64687e5c9ca05bc094910d4 /TAO | |
parent | f6acb7d2190c6b9c5476297393a0da18ea2e796c (diff) | |
download | ATCD-bd1dcd3c460b27d635f5230f26ecfe32eb251fdb.tar.gz |
*** empty log message ***
Diffstat (limited to 'TAO')
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LB_ObjectGroup_Map.cpp | 7 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LB_ObjectGroup_Map.h | 29 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LB_ObjectGroup_Map.inl | 13 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LB_ReplicaInfo.h | 3 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectGroup_Map.cpp | 7 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectGroup_Map.h | 29 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectGroup_Map.inl | 13 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Pull_Handler.cpp | 41 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Pull_Handler.h | 64 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ReplicaInfo.h | 3 |
10 files changed, 209 insertions, 0 deletions
diff --git a/TAO/orbsvcs/orbsvcs/LB_ObjectGroup_Map.cpp b/TAO/orbsvcs/orbsvcs/LB_ObjectGroup_Map.cpp index 201d4388cd4..7370cbf1078 100644 --- a/TAO/orbsvcs/orbsvcs/LB_ObjectGroup_Map.cpp +++ b/TAO/orbsvcs/orbsvcs/LB_ObjectGroup_Map.cpp @@ -2,10 +2,17 @@ #include "LB_ObjectGroup_Map.h" + ACE_RCSID (LoadBalancing, LB_ObjectGroup_Map, "$Id$") + +#if !defined (__ACE_INLINE__) +#include "LB_ObjectGroup_Map.inl" +#endif /* __ACE_INLINE__ */ + + TAO_LB_ObjectGroup_Map::TAO_LB_ObjectGroup_Map (void) : poa_ (), table_ () diff --git a/TAO/orbsvcs/orbsvcs/LB_ObjectGroup_Map.h b/TAO/orbsvcs/orbsvcs/LB_ObjectGroup_Map.h index 22fcd43e1d5..914814643aa 100644 --- a/TAO/orbsvcs/orbsvcs/LB_ObjectGroup_Map.h +++ b/TAO/orbsvcs/orbsvcs/LB_ObjectGroup_Map.h @@ -58,6 +58,18 @@ public: TAO_SYNCH_MUTEX lock; }; +/** + * @class TAO_LB_ObjectGroup_Map + * + * @brief Class that encapsulates hash map operations on an underlying + * object group map. + * + * This class contains all the operations necessary to manipulate the + * underlying object group map. The canonical hash map operations are + * supported, in addition to some other operations needed for mapping + * object group reference (rather than ObjectId) to object group map + * entry. + */ class TAO_LB_ObjectGroup_Map { public: @@ -70,6 +82,9 @@ public: ACE_Equal_To<PortableServer::ObjectId>, TAO_SYNCH_MUTEX> Table; + /// Forward STL-style iterator typedef. + typedef Table::iterator iterator; + /// Constructor TAO_LB_ObjectGroup_Map (void); @@ -90,6 +105,14 @@ public: /// Unbind the given ObjectId from the map. int unbind (const PortableServer::ObjectId &oid); + /// Return forward iterator that points to the beginning of the + /// underlying object group map. + iterator begin (void); + + /// Return forward iterator that points to the end of the underlying + /// object group map. + iterator end (void); + //@} /// Set the reference to the POA that created the object group @@ -115,6 +138,12 @@ private: Table table_; }; + + +#if defined (__ACE_INLINE__) +#include "LB_ObjectGroup_Map.inl" +#endif /* __ACE_INLINE__ */ + #include "ace/post.h" #endif /* TAO_LB_OBJECTGROUP_MAP_H */ diff --git a/TAO/orbsvcs/orbsvcs/LB_ObjectGroup_Map.inl b/TAO/orbsvcs/orbsvcs/LB_ObjectGroup_Map.inl new file mode 100644 index 00000000000..b9e7c64a1a9 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LB_ObjectGroup_Map.inl @@ -0,0 +1,13 @@ +// -*- C++ -*- + +ACE_INLINE TAO_LB_ObjectGroup_Map::iterator +TAO_LB_ObjectGroup_Map::begin (void) +{ + return this->table_.begin (); +} + +ACE_INLINE TAO_LB_ObjectGroup_Map::iterator +TAO_LB_ObjectGroup_Map::end (void) +{ + return this->table_.end (); +} diff --git a/TAO/orbsvcs/orbsvcs/LB_ReplicaInfo.h b/TAO/orbsvcs/orbsvcs/LB_ReplicaInfo.h index f37b5d23992..8e8df996c86 100644 --- a/TAO/orbsvcs/orbsvcs/LB_ReplicaInfo.h +++ b/TAO/orbsvcs/orbsvcs/LB_ReplicaInfo.h @@ -54,6 +54,9 @@ public: /// replica resides. LoadBalancing::LoadMonitor_var load_monitor; + /// Average load(s) on the replica + LoadBalancing::LoadList_var load_list; + }; #include "ace/post.h" diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectGroup_Map.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectGroup_Map.cpp index 201d4388cd4..7370cbf1078 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectGroup_Map.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectGroup_Map.cpp @@ -2,10 +2,17 @@ #include "LB_ObjectGroup_Map.h" + ACE_RCSID (LoadBalancing, LB_ObjectGroup_Map, "$Id$") + +#if !defined (__ACE_INLINE__) +#include "LB_ObjectGroup_Map.inl" +#endif /* __ACE_INLINE__ */ + + TAO_LB_ObjectGroup_Map::TAO_LB_ObjectGroup_Map (void) : poa_ (), table_ () diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectGroup_Map.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectGroup_Map.h index 22fcd43e1d5..914814643aa 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectGroup_Map.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectGroup_Map.h @@ -58,6 +58,18 @@ public: TAO_SYNCH_MUTEX lock; }; +/** + * @class TAO_LB_ObjectGroup_Map + * + * @brief Class that encapsulates hash map operations on an underlying + * object group map. + * + * This class contains all the operations necessary to manipulate the + * underlying object group map. The canonical hash map operations are + * supported, in addition to some other operations needed for mapping + * object group reference (rather than ObjectId) to object group map + * entry. + */ class TAO_LB_ObjectGroup_Map { public: @@ -70,6 +82,9 @@ public: ACE_Equal_To<PortableServer::ObjectId>, TAO_SYNCH_MUTEX> Table; + /// Forward STL-style iterator typedef. + typedef Table::iterator iterator; + /// Constructor TAO_LB_ObjectGroup_Map (void); @@ -90,6 +105,14 @@ public: /// Unbind the given ObjectId from the map. int unbind (const PortableServer::ObjectId &oid); + /// Return forward iterator that points to the beginning of the + /// underlying object group map. + iterator begin (void); + + /// Return forward iterator that points to the end of the underlying + /// object group map. + iterator end (void); + //@} /// Set the reference to the POA that created the object group @@ -115,6 +138,12 @@ private: Table table_; }; + + +#if defined (__ACE_INLINE__) +#include "LB_ObjectGroup_Map.inl" +#endif /* __ACE_INLINE__ */ + #include "ace/post.h" #endif /* TAO_LB_OBJECTGROUP_MAP_H */ diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectGroup_Map.inl b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectGroup_Map.inl new file mode 100644 index 00000000000..b9e7c64a1a9 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectGroup_Map.inl @@ -0,0 +1,13 @@ +// -*- C++ -*- + +ACE_INLINE TAO_LB_ObjectGroup_Map::iterator +TAO_LB_ObjectGroup_Map::begin (void) +{ + return this->table_.begin (); +} + +ACE_INLINE TAO_LB_ObjectGroup_Map::iterator +TAO_LB_ObjectGroup_Map::end (void) +{ + return this->table_.end (); +} diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Pull_Handler.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Pull_Handler.cpp new file mode 100644 index 00000000000..a0aa7f4397b --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Pull_Handler.cpp @@ -0,0 +1,41 @@ +// -*- C++ -*- + +#include "LB_Pull_Handler.h" + +ACE_RCSID (LoadBalancing, + LB_Pull_Handler, + "$Id$") + +TAO_LB_Pull_Handler::TAO_LB_Pull_Handler ( + TAO_LB_ObjectGroup_Map &object_group_map) + : object_group_map_ (object_group_map) +{ +} + +int +TAO_LB_Pull_Handler::handle_timeout ( + const ACE_Time_Value & /* current_time */, + const void * /* arg */) +{ + TAO_LB_ObjectGroup_Map::iterator begin = + this->object_group_map_.begin (); + + TAO_LB_ObjectGroup_Map::iterator begin = + this->object_group_map_.end (); + + // Iterate over all registered object groups. + // + // @todo This could be potentially very slow. Improve concurrent + // operation at some point in the near future. + for (TAO_LB_ObjectGroup_Map::iterator i = begin; + i != end; + ++i + { + TAO_LB_ObjectGroup_Map_Entry *object_group = i->ext_id_; + + + } + + + return 0; +} diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Pull_Handler.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Pull_Handler.h new file mode 100644 index 00000000000..a7c1c39a1c7 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Pull_Handler.h @@ -0,0 +1,64 @@ +// -*- C++ -*- + +//======================================================================= +/** + * @file LB_Pull_Handler.h + * + * $Id$ + * + * @author Ossama Othman <ossama@uci.edu> + */ +//======================================================================= + + +#ifndef TAO_LB_PULL_HANDLER_H +#define TAO_LB_PULL_HANDLER_H + +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "orbsvcs/LoadBalancingC.h" + +#include "LB_ReplicaInfo.h" + + +// Forward declarations. +class TAO_LB_ObjectGroup_Map; + + +/** + * @class TAO_LB_Pull_Handler + * + * @brief Event handler used when the "pull" monitoring style is + * configured. + * + * An event handler designed to pull loads from all load monitors + * registered with the load balancer. + */ +class TAO_LB_Pull_Handler : public ACE_Event_Handler +{ +public: + + /// Constructor + TAO_LB_Pull_Handler (TAO_LB_ObjectGroup_Map &object_group_map); + + /// Receive the timeout event. + / + virtual int handle_timeout (const ACE_Time_Value ¤t_time, + const void *arg); + +private: + + /// The table that contains all object groups registered with the + /// load balancer. + TAO_LB_ObjectGroup_Map &object_group_map_; + +}; +#include "ace/post.h" + +#endif /* TAO_LB_PULL_HANDLER_H */ diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ReplicaInfo.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ReplicaInfo.h index f37b5d23992..8e8df996c86 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ReplicaInfo.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ReplicaInfo.h @@ -54,6 +54,9 @@ public: /// replica resides. LoadBalancing::LoadMonitor_var load_monitor; + /// Average load(s) on the replica + LoadBalancing::LoadList_var load_list; + }; #include "ace/post.h" |