diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2001-06-21 05:17:18 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2001-06-21 05:17:18 +0000 |
commit | 81a1a3fc473b5364ae32e0d030a977dc541e8959 (patch) | |
tree | 8ee521b4226f7085e6de9378c531e298e13afa26 | |
parent | 85774468ea596af18f4d83c04de36974b2bad92c (diff) | |
download | ATCD-81a1a3fc473b5364ae32e0d030a977dc541e8959.tar.gz |
*** empty log message ***
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LoadBalancing.idl | 2 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancingI.cpp | 50 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancingI.h | 14 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LoadBalancingI.cpp | 50 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LoadBalancingI.h | 14 |
5 files changed, 122 insertions, 8 deletions
diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing.idl b/TAO/orbsvcs/orbsvcs/LoadBalancing.idl index ec16142cd2f..d9d18eaa186 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing.idl +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing.idl @@ -254,6 +254,8 @@ module LoadBalancing LoadMonitor get_load_monitor (in Location the_location) raises (LocationNotFound); + void remove_load_monitor (in Location the_location) + raises (LocationNotFound); }; /// It's not clear this interface is needed for the Load Balancer. diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancingI.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancingI.cpp index b1581573a10..066e4bbebfe 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancingI.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancingI.cpp @@ -17,7 +17,8 @@ ACE_RCSID (LoadBalancing, // Implementation skeleton constructor TAO_LoadBalancing_ReplicationManager_i::TAO_LoadBalancing_ReplicationManager_i (void) - : poa_ (), + : orb_ (), + poa_ (), lock_ (), location_map_ object_group_map_ (), @@ -98,6 +99,20 @@ TAO_LoadBalancing_ReplicationManager_i::register_load_monitor ( } else ACE_THROW (LoadBalancing::MonitorAlreadyPresent ()); + + + // Register the "pull monitoring" event handler only after the first + // load monitor is registered. + if (this->location_map_.current_size () == 1) + { + ACE_Time_Value interval (1, 0); + ACE_Time_Value restart (1, 0); + ACE_Reactor *reactor = this->orb_->orb_core ()->reactor (); + (void) reactor->schedule_timer (&this->pull_handler_, + 0, + interval, + restart); + } } LoadBalancing::LoadMonitor_ptr @@ -122,6 +137,30 @@ TAO_LoadBalancing_ReplicationManager_i::get_load_monitor ( } void +TAO_LoadBalancing_ReplicationManager_i::remove_load_monitor ( + const LoadBalancing::Location &the_location, + CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException, + LoadBalancing::LocationNotFound)) +{ + TAO_LB_Location_Map_Entry *location_entry = 0; + + if (this->location_map_.find (the_location, + location_entry) != 0) + ACE_THROW (LoadBalancing::LocationNotFound); + + (void) location_entry->load_monitor.out (); + + // If no load monitors are registered with the load balancer than + // shutdown the "pull monitoring." +// if (this->location_map_.current_size () == 0) +// { +// ACE_Reactor *reactor = this->orb_->orb_core ()->reactor (); +// (void) reactor->cancel_timer (&this->pull_handler_); +// } +} + +void TAO_LoadBalancing_ReplicationManager_i::set_default_properties ( const LoadBalancing::Properties &props, CORBA::Environment &ACE_TRY_ENV) @@ -346,11 +385,15 @@ TAO_LoadBalancing_ReplicationManager_i::create_object ( LoadBalancing::InvalidProperty, LoadBalancing::CannotMeetCriteria)) { - return + CORBA::Object_ptr obj = this->generic_factory_.create_object (type_id, the_criteria, factory_creation_id, ACE_TRY_ENV); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + + return obj; } #if 0 @@ -436,6 +479,7 @@ TAO_LoadBalancing_ReplicationManager_i::replica ( void TAO_LoadBalancing_ReplicationManager_i::init ( + CORBA::ORB_ptr orb, PortableServer::POA_ptr root_poa, CORBA::Environment &ACE_TRY_ENV) { @@ -512,6 +556,8 @@ TAO_LoadBalancing_ReplicationManager_i::init ( this->object_group_map_.poa (this->poa_.in ()); this->generic_factory_.poa (this->poa_.in ()); + + this->orb_ = CORBA::ORB::_duplicate (orb); // } // ACE_CATCHANY // { diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancingI.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancingI.h index 0dcecf939e6..edf69749b89 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancingI.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LoadBalancingI.h @@ -58,8 +58,7 @@ public: ACE_THROW_SPEC ((CORBA::SystemException, LoadBalancing::InterfaceNotFound)); - /// Register a load monitor with the load balancer - /// ReplicationManager. + /// Register a load monitor with the load balancer. virtual void register_load_monitor ( LoadBalancing::LoadMonitor_ptr load_monitor, const LoadBalancing::Location & the_location, @@ -74,6 +73,14 @@ public: ACE_THROW_SPEC ((CORBA::SystemException, LoadBalancing::LocationNotFound)); + /// Remove a load monitor at the given location from the load + /// balancer. + virtual void remove_load_monitor ( + const LoadBalancing::Location & the_location, + CORBA::Environment &ACE_TRY_ENV = TAO_default_environment ()) + ACE_THROW_SPEC ((CORBA::SystemException, + LoadBalancing::LocationNotFound)); + /** * @name LoadBalancing::PropertyManager methods */ @@ -319,6 +326,9 @@ private: private: + /// Pseudo-reference to the ORB. + CORBA::ORB_var orb_; + /// The POA that dispatches requests to the ReplicaLocator. PortableServer::POA_var poa_; diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancingI.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancingI.cpp index b1581573a10..066e4bbebfe 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancingI.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancingI.cpp @@ -17,7 +17,8 @@ ACE_RCSID (LoadBalancing, // Implementation skeleton constructor TAO_LoadBalancing_ReplicationManager_i::TAO_LoadBalancing_ReplicationManager_i (void) - : poa_ (), + : orb_ (), + poa_ (), lock_ (), location_map_ object_group_map_ (), @@ -98,6 +99,20 @@ TAO_LoadBalancing_ReplicationManager_i::register_load_monitor ( } else ACE_THROW (LoadBalancing::MonitorAlreadyPresent ()); + + + // Register the "pull monitoring" event handler only after the first + // load monitor is registered. + if (this->location_map_.current_size () == 1) + { + ACE_Time_Value interval (1, 0); + ACE_Time_Value restart (1, 0); + ACE_Reactor *reactor = this->orb_->orb_core ()->reactor (); + (void) reactor->schedule_timer (&this->pull_handler_, + 0, + interval, + restart); + } } LoadBalancing::LoadMonitor_ptr @@ -122,6 +137,30 @@ TAO_LoadBalancing_ReplicationManager_i::get_load_monitor ( } void +TAO_LoadBalancing_ReplicationManager_i::remove_load_monitor ( + const LoadBalancing::Location &the_location, + CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException, + LoadBalancing::LocationNotFound)) +{ + TAO_LB_Location_Map_Entry *location_entry = 0; + + if (this->location_map_.find (the_location, + location_entry) != 0) + ACE_THROW (LoadBalancing::LocationNotFound); + + (void) location_entry->load_monitor.out (); + + // If no load monitors are registered with the load balancer than + // shutdown the "pull monitoring." +// if (this->location_map_.current_size () == 0) +// { +// ACE_Reactor *reactor = this->orb_->orb_core ()->reactor (); +// (void) reactor->cancel_timer (&this->pull_handler_); +// } +} + +void TAO_LoadBalancing_ReplicationManager_i::set_default_properties ( const LoadBalancing::Properties &props, CORBA::Environment &ACE_TRY_ENV) @@ -346,11 +385,15 @@ TAO_LoadBalancing_ReplicationManager_i::create_object ( LoadBalancing::InvalidProperty, LoadBalancing::CannotMeetCriteria)) { - return + CORBA::Object_ptr obj = this->generic_factory_.create_object (type_id, the_criteria, factory_creation_id, ACE_TRY_ENV); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + + return obj; } #if 0 @@ -436,6 +479,7 @@ TAO_LoadBalancing_ReplicationManager_i::replica ( void TAO_LoadBalancing_ReplicationManager_i::init ( + CORBA::ORB_ptr orb, PortableServer::POA_ptr root_poa, CORBA::Environment &ACE_TRY_ENV) { @@ -512,6 +556,8 @@ TAO_LoadBalancing_ReplicationManager_i::init ( this->object_group_map_.poa (this->poa_.in ()); this->generic_factory_.poa (this->poa_.in ()); + + this->orb_ = CORBA::ORB::_duplicate (orb); // } // ACE_CATCHANY // { diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancingI.h b/TAO/orbsvcs/orbsvcs/LoadBalancingI.h index 0dcecf939e6..edf69749b89 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancingI.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancingI.h @@ -58,8 +58,7 @@ public: ACE_THROW_SPEC ((CORBA::SystemException, LoadBalancing::InterfaceNotFound)); - /// Register a load monitor with the load balancer - /// ReplicationManager. + /// Register a load monitor with the load balancer. virtual void register_load_monitor ( LoadBalancing::LoadMonitor_ptr load_monitor, const LoadBalancing::Location & the_location, @@ -74,6 +73,14 @@ public: ACE_THROW_SPEC ((CORBA::SystemException, LoadBalancing::LocationNotFound)); + /// Remove a load monitor at the given location from the load + /// balancer. + virtual void remove_load_monitor ( + const LoadBalancing::Location & the_location, + CORBA::Environment &ACE_TRY_ENV = TAO_default_environment ()) + ACE_THROW_SPEC ((CORBA::SystemException, + LoadBalancing::LocationNotFound)); + /** * @name LoadBalancing::PropertyManager methods */ @@ -319,6 +326,9 @@ private: private: + /// Pseudo-reference to the ORB. + CORBA::ORB_var orb_; + /// The POA that dispatches requests to the ReplicaLocator. PortableServer::POA_var poa_; |