diff options
Diffstat (limited to 'TAO/CIAO/ciao/Servant_Activator.cpp')
-rw-r--r-- | TAO/CIAO/ciao/Servant_Activator.cpp | 195 |
1 files changed, 0 insertions, 195 deletions
diff --git a/TAO/CIAO/ciao/Servant_Activator.cpp b/TAO/CIAO/ciao/Servant_Activator.cpp deleted file mode 100644 index 6830454ac35..00000000000 --- a/TAO/CIAO/ciao/Servant_Activator.cpp +++ /dev/null @@ -1,195 +0,0 @@ -#include "Servant_Activator.h" -#include "CIAO_common.h" -#include "Port_Activator.h" -#include "ace/Log_Msg.h" -#include "ace/OS_NS_string.h" - -ACE_RCSID (ciao, - Servant_Activator, - "$Id$") - -namespace CIAO -{ - Servant_Activator::Servant_Activator (CORBA::ORB_ptr o) - : orb_ (CORBA::ORB::_duplicate (o)) - // @@ TODO, avoid this magic number - , pa_ (64) - , slot_index_ (0) - { - } - - Servant_Activator::~Servant_Activator (void) - { - { - ACE_GUARD (TAO_SYNCH_MUTEX, - guard, - this->mutex_); - - const size_t sz = this->slot_index_; - - for (size_t t = 0; t != sz; ++t) - { - Port_Activator *&tmp = this->pa_[t]; - - delete tmp; - } - } - } - - bool - Servant_Activator::update_port_activator ( - const PortableServer::ObjectId &oid - ACE_ENV_ARG_DECL_NOT_USED) - ACE_THROW_SPEC ((CORBA::SystemException)) - { - CORBA::String_var str = - PortableServer::ObjectId_to_string (oid); - { - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, - guard, - this->mutex_, - 0); - const size_t sz = this->slot_index_; - for (size_t t = 0; t != sz; ++t) - { - Port_Activator *&tmp = this->pa_[t]; - if (ACE_OS::strcmp (tmp->name (), str.in ()) == 0) - { - tmp->set_name ("dummy"); - //delete tmp; - //--this->slot_index_; - } - } - } - return true; - } - - PortableServer::Servant - Servant_Activator::incarnate (const PortableServer::ObjectId &oid, - PortableServer::POA_ptr - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException, - PortableServer::ForwardRequest)) - { - CORBA::String_var str = - PortableServer::ObjectId_to_string (oid); - - if (CIAO::debug_level () > 9) - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - Servant_Activator::incarnate, " - "activating port name [%s] \n", - str.in ())); - - { - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, - guard, - this->mutex_, - 0); - - const size_t sz = this->slot_index_; - - Port_Activator *tmp = 0; - - for (size_t t = 0; t != sz; ++t) - { - if (this->pa_.get (tmp, t) == -1) - ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (), - 0); - - if (tmp == 0) - { - if (CIAO::debug_level () > 9) - ACE_ERROR ((LM_ERROR, - "CIAO (%P|%t) - Servant_Activator::incarnate ()," - " value from the array is null \n")); - continue; - } - if (ACE_OS::strcmp (tmp->name (), - str.in ()) == 0) - { - // We should try avoiding making outbound calls with the - // lock held. Oh well, let us get some sense of sanity in - // CIAO to do think about these. - ACE_DEBUG ((LM_DEBUG, "Activating Port %s\n", - str.in ())); - return this->pa_[t]->activate (oid - ACE_ENV_ARG_PARAMETER); - } - } - } - ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (), - 0); - } - - void - Servant_Activator::etherealize (const PortableServer::ObjectId &oid, - PortableServer::POA_ptr , - PortableServer::Servant servant, - CORBA::Boolean , - CORBA::Boolean - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) - { - CORBA::String_var str = - PortableServer::ObjectId_to_string (oid); - - const size_t sz = this->slot_index_; - - Port_Activator *tmp = 0; - - for (size_t t = 0; t != sz; ++t) - { - if (this->pa_.get (tmp, t) == -1) - { - ACE_DEBUG ((LM_DEBUG, "Could not get Port Activator\n")); - continue; - } - - if (tmp == 0) - { - ACE_DEBUG ((LM_DEBUG, "Port Activator is NULL\n")); - continue; - } - if (ACE_OS::strcmp (tmp->name (), - str.in ()) == 0) - { - ACE_DEBUG ((LM_DEBUG, "Deactivating Port %s\n", - str.in ())); - this->pa_[t]->deactivate (servant - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } - } - } - - bool - Servant_Activator::register_port_activator (Port_Activator *pa) - { - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, - guard, - this->mutex_, - false); - - // @@ TODO, need to implement a better algorithm here. - // - if (this->slot_index_ >= this->pa_.size ()) - this->pa_.size ((this->slot_index_ + 1)); - - if (this->pa_.set (pa, this->slot_index_) == 0) - { - ++this->slot_index_; - - if (CIAO::debug_level () > 9) - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - Servant_Activator::register_port_activator" - " with port name [%s]," - " the slot_index_ is [%d] \n", - pa->name (), - this->slot_index_)); - - return true; - } - - return false; - } -} |