From 432e0e48e43ef432e9c27b24ac24811675e64dbb Mon Sep 17 00:00:00 2001 From: Ossama Othman Date: Sat, 26 Jul 2003 18:37:56 +0000 Subject: ChangeLogTag:Sat Jul 26 11:37:17 2003 Ossama Othman --- TAO/ChangeLog | 36 +++++ TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Component.h | 2 +- .../orbsvcs/LoadBalancing/LB_IORInterceptor.cpp | 159 +++++++++++---------- .../orbsvcs/LoadBalancing/LB_IORInterceptor.h | 14 +- .../LoadBalancing/LB_ObjectReferenceFactory.cpp | 96 ++++++------- .../LoadBalancing/LB_ServerRequestInterceptor.cpp | 11 +- TAO/tao/Pseudo_VarOut_T.cpp | 4 +- TAO/tao/Pseudo_VarOut_T.inl | 2 + 8 files changed, 185 insertions(+), 139 deletions(-) diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 3204d1140bf..5a785c3c901 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,39 @@ +Sat Jul 26 11:37:17 2003 Ossama Othman + + * orbsvcs/orbsvcs/LoadBalancing/LB_Component.h: + + Uncommented ACE_STATIC_SVC_REQUIRE macro. It is needed when + using this component in a statically linked application. + + * orbsvcs/orbsvcs/LoadBalancing/LB_IORInterceptor.h: + * orbsvcs/orbsvcs/LoadBalancing/LB_IORInterceptor.cpp: + + Re-enabled code that automatically and transparently adds load + balancing to servers. This was made possible by Carlos' + IORInterceptor deadlock fix (see Bug 1414). + + * orbsvcs/orbsvcs/LoadBalancing/LB_ObjectReferenceFactory.cpp + (find_object_group): + + Fixed problem where nil object group reference was used when + adding members to the object group. In particular, use + "_retn()" not "out()" when transferring ownership of object + group reference. + + * orbsvcs/orbsvcs/LoadBalancing/LB_ServerRequestInterceptor.cpp + (receive_request_service_contexts): + + Commented out code that attempts to check for a load + balancing-specific IOP::ServiceContext. Such a service context + is no longer used. A CORBA::TRANSIENT exception is now thrown + for all requests when a load alert is enabled, regardless of + whether or not the target is load balanced. + + * tao/Pseudo_VarOut_T.inl: + * tao/Pseudo_VarOut_T.cpp: + + Nuked trailing whitespace. + Sat Jul 26 13:27:35 2003 Venkita Subramonian * orbsvcs/orbsvcs/RTKokyuEvent.dsp: diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Component.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Component.h index 0c3da8e7d27..0f290d8412b 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Component.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Component.h @@ -58,7 +58,7 @@ protected: ACE_STATIC_SVC_DECLARE_EXPORT (TAO_LoadBalancing, TAO_LB_Component) - //ACE_STATIC_SVC_REQUIRE (TAO_LB_Component) +ACE_STATIC_SVC_REQUIRE (TAO_LB_Component) ACE_FACTORY_DECLARE (TAO_LoadBalancing, TAO_LB_Component) diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_IORInterceptor.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_IORInterceptor.cpp index abefc409f72..9b814014b42 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,91 +95,92 @@ TAO_LB_IORInterceptor::components_established ( void TAO_LB_IORInterceptor::adapter_manager_state_changed ( PortableInterceptor::AdapterManagerId, - PortableInterceptor::AdapterState /* state */ - 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; -// } + 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_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; -// } + 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_NOT_USED) +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; -// } - -// 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; + { + 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 + { + if (TAO_debug_level > 0) + 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 922554d8b27..7252318027a 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_IORInterceptor.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_IORInterceptor.h @@ -84,7 +84,7 @@ public: ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC (( CORBA::SystemException - )); + )); virtual void components_established ( PortableInterceptor::IORInfo_ptr info @@ -132,14 +132,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_ObjectReferenceFactory.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectReferenceFactory.cpp index 5e5c3de6a0c..d4f5b0332e7 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectReferenceFactory.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectReferenceFactory.cpp @@ -175,67 +175,65 @@ TAO_LB_ObjectReferenceFactory::find_object_group ( PortableGroup::ObjectGroup_out object_group ACE_ENV_ARG_DECL) { - if (this->load_managed_object (repository_id, index)) + if (!this->load_managed_object (repository_id, index)) + return 0; + + PortableGroup::ObjectGroup_var group; + if (this->table_.find (repository_id, group) != 0) { - PortableGroup::ObjectGroup_var group; - if (this->table_.find (repository_id, group) != 0) + if (ACE_OS::strcasecmp (this->object_groups_[index].in (), + "CREATE") == 0) { - if (ACE_OS::strcasecmp (this->object_groups_[index].in (), - "CREATE") == 0) - { - PortableGroup::Criteria criteria (1); - criteria.length (1); + PortableGroup::Criteria criteria (1); + criteria.length (1); - PortableGroup::Property & property = criteria[0]; - property.nam.length (1); + PortableGroup::Property & property = criteria[0]; + property.nam.length (1); - property.nam[0].id = - CORBA::string_dup ("org.omg.PortableGroup.MembershipStyle"); + 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; + // Configure for application-controlled membership. + PortableGroup::MembershipStyleValue msv = + PortableGroup::MEMB_APP_CTRL; + property.val <<= msv; - PortableGroup::GenericFactory::FactoryCreationId_var fcid; - - group = - this->lm_->create_object (repository_id, - criteria, - fcid.out () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); + PortableGroup::GenericFactory::FactoryCreationId_var fcid; - const CORBA::ULong len = this->fcids_.size (); - this->fcids_.size (len + 1); // Incremental growth. Yuck! - this->fcids_[len] = fcid; - } - else - { - group = - this->orb_->string_to_object (this->object_groups_[index].in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); - } + group = + this->lm_->create_object (repository_id, + criteria, + fcid.out () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); - if (this->table_.bind (repository_id, group) != 0) - { - if (TAO_debug_level > 0) - ACE_ERROR ((LM_ERROR, - "TAO_LB_ObjectReferenceFactory::" - "find_object_group - " - "Couldn't bind object group reference.\n")); + const CORBA::ULong len = this->fcids_.size (); + this->fcids_.size (len + 1); // Incremental growth. Yuck! + this->fcids_[len] = fcid; + } + else + { + group = + this->orb_->string_to_object (this->object_groups_[index].in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + } - ACE_THROW_RETURN (CORBA::INTERNAL (), 0); - } + if (this->table_.bind (repository_id, group) != 0) + { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + "TAO_LB_ObjectReferenceFactory::" + "find_object_group - " + "Couldn't bind object group reference.\n")); - object_group = group.out (); - } + ACE_THROW_RETURN (CORBA::INTERNAL (), 0); + } - return 1; + object_group = group._retn (); } - else - return 0; + + return 1; } CORBA::Boolean diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ServerRequestInterceptor.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ServerRequestInterceptor.cpp index 434b30b4918..c8359eb57eb 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ServerRequestInterceptor.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ServerRequestInterceptor.cpp @@ -34,13 +34,14 @@ TAO_LB_ServerRequestInterceptor::destroy (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) void TAO_LB_ServerRequestInterceptor::receive_request_service_contexts ( - PortableInterceptor::ServerRequestInfo_ptr ri + PortableInterceptor::ServerRequestInfo_ptr /* ri */ ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, PortableInterceptor::ForwardRequest)) { if (this->load_alert_.alerted ()) { +#if 0 ACE_TRY { IOP::ServiceContext_var service_context = @@ -99,6 +100,14 @@ TAO_LB_ServerRequestInterceptor::receive_request_service_contexts ( } ACE_ENDTRY; ACE_CHECK; +#else + // Force the client to try another profile since this location + // is currently overloaded. + // + // NOTE: This applies to both load balanced and non-load + // balanced targets. + ACE_THROW (CORBA::TRANSIENT ()); +#endif /* 0 */ } } diff --git a/TAO/tao/Pseudo_VarOut_T.cpp b/TAO/tao/Pseudo_VarOut_T.cpp index 48ac93ce254..4d65623c5a2 100644 --- a/TAO/tao/Pseudo_VarOut_T.cpp +++ b/TAO/tao/Pseudo_VarOut_T.cpp @@ -9,8 +9,8 @@ #include "tao/Pseudo_VarOut_T.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID (tao, - Pseudo_VarOut_T, +ACE_RCSID (tao, + Pseudo_VarOut_T, "$Id$") template diff --git a/TAO/tao/Pseudo_VarOut_T.inl b/TAO/tao/Pseudo_VarOut_T.inl index 194c5b6a9fb..b13e74045a6 100644 --- a/TAO/tao/Pseudo_VarOut_T.inl +++ b/TAO/tao/Pseudo_VarOut_T.inl @@ -1,3 +1,5 @@ +// -*- C++ -*- +// // $Id$ template -- cgit v1.2.1