diff options
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/LoadBalancer_i.cpp')
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LoadBalancer_i.cpp | 92 |
1 files changed, 49 insertions, 43 deletions
diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancer_i.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancer_i.cpp index f4dc0bee6a7..b7b48b52aff 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancer_i.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancer_i.cpp @@ -2,89 +2,95 @@ // $Id$ -#include "orbsvcs/LoadBalancing/LoadBalancer_i.h" -#include "orbsvcs/LoadBalancing/ReplicaProxy.h" +#include "LoadBalancer_i.h" +#include "ReplicaProxy.h" -ACE_RCSID(orbsvcs, Load_Balancer_i, "$Id$") +ACE_RCSID(orbsvcs, LoadBalancer, "$Id$") #if !defined (__ACE_INLINE__) #include "LoadBalancer_i.i" #endif /* __ACE_INLINE__ */ -LoadBalancer_Impl::LoadBalancer_Impl (const char *interface_id, - Load_Balancing_Strategy *strategy, - PortableServer::POA_ptr poa) +TAO_LB_LoadBalancer::TAO_LB_LoadBalancer ( + const char *interface_id, + TAO_LB_LoadBalancing_Strategy *strategy, + PortableServer::POA_ptr poa) : redirector_ (this, interface_id), strategy_ (strategy), poa_ (PortableServer::POA::_duplicate (poa)) { - // @@ Ossama: in general it is a bad idea to perform operations like - // this in the constructor, the behavior on platforms with exception - // and without native exception support is simply too different. - - // Nothing else - - ACE_TRY_NEW_ENV - { - PortableServer::ObjectId_var oid = - this->poa_->activate_object (&this->redirector_, - ACE_TRY_ENV); - ACE_TRY_CHECK; - - this->group_identity_ = - this->poa_->id_to_reference (oid.in (), - ACE_TRY_ENV); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - } - ACE_ENDTRY; + (void) this->init (); } -LoadBalancer_Impl::~LoadBalancer_Impl (void) +TAO_LB_LoadBalancer::~TAO_LB_LoadBalancer (void) { // Nothing else } LoadBalancing::ReplicaProxy_ptr -LoadBalancer_Impl::connect (LoadBalancing::ReplicaControl_ptr control, - CORBA::Object_ptr replica, - CORBA::Environment &ACE_TRY_ENV) +TAO_LB_LoadBalancer::connect (LoadBalancing::ReplicaControl_ptr control, + CORBA::Object_ptr replica, + CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((LoadBalancing::ReplicaProxy::NilControl, LoadBalancing::ReplicaProxy::NilReplica, CORBA::SystemException)) { - ReplicaProxy_Impl *impl = 0; - ACE_NEW_THROW_EX (impl, - ReplicaProxy_Impl, - CORBA::NO_MEMORY ()); + TAO_LB_ReplicaProxy *proxy = 0; + ACE_NEW_THROW_EX (proxy, + TAO_LB_ReplicaProxy, + CORBA::NO_MEMORY ( + CORBA_SystemException::_tao_minor_code ( + TAO_DEFAULT_MINOR_CODE, + ENOMEM), + CORBA::COMPLETED_NO)); ACE_CHECK_RETURN (LoadBalancing::ReplicaProxy::_nil ()); - PortableServer::ServantBase_var proxy_servant = impl; + PortableServer::ServantBase_var proxy_servant = proxy; - impl->connect (this, control, replica, ACE_TRY_ENV); + proxy->connect (this, control, replica, ACE_TRY_ENV); ACE_CHECK_RETURN (LoadBalancing::ReplicaProxy::_nil ()); - if (this->strategy_->insert (impl) == -1) + if (this->strategy_->insert (proxy) == -1) { ACE_THROW_RETURN (CORBA::INTERNAL (), LoadBalancing::ReplicaProxy::_nil ()); } - return impl->_this (ACE_TRY_ENV); + return proxy->_this (ACE_TRY_ENV); } CORBA::Object_ptr -LoadBalancer_Impl::group_identity (CORBA::Environment &) +TAO_LB_LoadBalancer::group_identity (CORBA::Environment &) ACE_THROW_SPEC ((CORBA::SystemException)) { return CORBA::Object::_duplicate (this->group_identity_.in ()); } void -LoadBalancer_Impl::load_changed (ReplicaProxy_Impl *proxy, - CORBA::Environment &ACE_TRY_ENV) +TAO_LB_LoadBalancer::load_changed (TAO_LB_ReplicaProxy *proxy, + CORBA::Environment &ACE_TRY_ENV) { this->strategy_->load_changed (proxy, ACE_TRY_ENV); } + +int +TAO_LB_LoadBalancer::init (void) +{ + ACE_TRY_NEW_ENV + { + PortableServer::ObjectId_var oid = + this->poa_->activate_object (&this->redirector_, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + this->group_identity_ = + this->poa_->id_to_reference (oid.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + // @@ Should we do anything here? + } + ACE_ENDTRY; +} |