diff options
author | jai <jai@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2005-02-13 21:39:04 +0000 |
---|---|---|
committer | jai <jai@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2005-02-13 21:39:04 +0000 |
commit | 05ecf965a1b7b2ca01d4cd3de6c1cf1f128cba55 (patch) | |
tree | 1b97f5a06aeaefea11f0bdf28d90a2969903fc43 /TAO/CIAO/DAnCE | |
parent | aa3bb33f251dde9ca47823bdce3569496e045194 (diff) | |
download | ATCD-dynamic_swapping_1.tar.gz |
*** empty log message ***dynamic_swapping_1
Diffstat (limited to 'TAO/CIAO/DAnCE')
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/Container_Base.cpp | 8 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/Container_Base.h | 4 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/Servant_Activator.cpp | 39 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/Servant_Activator.h | 4 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/Servant_Impl_T.cpp | 23 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/Servant_Impl_T.h | 4 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/Swapping_Container.cpp | 16 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/ciao/Swapping_Container.h | 6 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/examples/Hello/Sender/SenderE.idl.new_impl | 4 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/examples/Hello/Sender/Sender_exec_1.cpp | 5 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/examples/Hello/Sender/Sender_svnt.cpp.with-connections | 197 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/examples/Hello/Sender/Sender_svnt.h.with-connections | 12 |
12 files changed, 157 insertions, 165 deletions
diff --git a/TAO/CIAO/DAnCE/ciao/Container_Base.cpp b/TAO/CIAO/DAnCE/ciao/Container_Base.cpp index f9d737b548e..cdd2d5b9e89 100644 --- a/TAO/CIAO/DAnCE/ciao/Container_Base.cpp +++ b/TAO/CIAO/DAnCE/ciao/Container_Base.cpp @@ -422,6 +422,14 @@ namespace CIAO } void + Session_Container::deactivate_facet (PortableServer::ObjectId &oid + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + } + + void Session_Container::delete_servant_map (PortableServer::ObjectId & ACE_ENV_ARG_DECL) diff --git a/TAO/CIAO/DAnCE/ciao/Container_Base.h b/TAO/CIAO/DAnCE/ciao/Container_Base.h index 2385b0a0a61..2ee12e2d46c 100644 --- a/TAO/CIAO/DAnCE/ciao/Container_Base.h +++ b/TAO/CIAO/DAnCE/ciao/Container_Base.h @@ -246,6 +246,10 @@ namespace CIAO virtual void delete_servant_map (PortableServer::ObjectId &oid ACE_ENV_ARG_DECL); + virtual void deactivate_facet (PortableServer::ObjectId &oid + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual CORBA::Object_ptr get_home_objref (PortableServer::Servant p ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); diff --git a/TAO/CIAO/DAnCE/ciao/Servant_Activator.cpp b/TAO/CIAO/DAnCE/ciao/Servant_Activator.cpp index 03899555bfd..cdd1c8d18b0 100644 --- a/TAO/CIAO/DAnCE/ciao/Servant_Activator.cpp +++ b/TAO/CIAO/DAnCE/ciao/Servant_Activator.cpp @@ -36,6 +36,33 @@ namespace CIAO } } + bool + Servant_Activator::update_port_activator ( + const PortableServer::ObjectId &oid + ACE_ENV_ARG_DECL) + 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 unsigned int sz = this->slot_index_; + for (unsigned int t = 0; t != sz; ++t) + { + Port_Activator *&tmp = this->pa_[t]; + if (ACE_OS::strcmp (tmp->name (), str.in ()) == 0) + { + delete tmp; + --this->slot_index_; + } + } + } + return true; + } + PortableServer::Servant Servant_Activator::incarnate (const PortableServer::ObjectId &oid, PortableServer::POA_ptr @@ -78,11 +105,13 @@ namespace CIAO } 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. - return this->pa_[t]->activate (oid - ACE_ENV_ARG_PARAMETER); + { + // 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. + return this->pa_[t]->activate (oid + ACE_ENV_ARG_PARAMETER); + } } } ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (), diff --git a/TAO/CIAO/DAnCE/ciao/Servant_Activator.h b/TAO/CIAO/DAnCE/ciao/Servant_Activator.h index a9f75028a67..d7242ae791c 100644 --- a/TAO/CIAO/DAnCE/ciao/Servant_Activator.h +++ b/TAO/CIAO/DAnCE/ciao/Servant_Activator.h @@ -55,6 +55,10 @@ namespace CIAO virtual ~Servant_Activator (void); + bool update_port_activator (const PortableServer::ObjectId &oid + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + /// Template methods overridden to get callbacks. /** * If you would like to know the details of the following two diff --git a/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.cpp b/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.cpp index 2277645ae55..7aee4159153 100644 --- a/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.cpp +++ b/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.cpp @@ -161,6 +161,29 @@ namespace CIAO typename EXEC_VAR, typename CONTEXT> void + Servant_Impl<BASE_SKEL, EXEC, EXEC_VAR, CONTEXT>::activate_component ( + ACE_ENV_SINGLE_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + if (this->is_activated () == 0) + { + this->ciao_preactivate ( + ACE_ENV_SINGLE_ARG_PARAMETER); + + this->ciao_activate ( + ACE_ENV_SINGLE_ARG_PARAMETER); + + this->ciao_postactivate ( + ACE_ENV_SINGLE_ARG_PARAMETER); + } + } + + template <typename BASE_SKEL, + typename EXEC, + typename EXEC_VAR, + typename CONTEXT> + void Servant_Impl<BASE_SKEL, EXEC, EXEC_VAR, CONTEXT>::ciao_preactivate ( ACE_ENV_SINGLE_ARG_DECL ) diff --git a/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.h b/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.h index 246bcdbef35..e507fe8d93f 100644 --- a/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.h +++ b/TAO/CIAO/DAnCE/ciao/Servant_Impl_T.h @@ -95,6 +95,10 @@ namespace CIAO is_activated (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); + void + activate_component (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + protected: CORBA::Boolean activated_; diff --git a/TAO/CIAO/DAnCE/ciao/Swapping_Container.cpp b/TAO/CIAO/DAnCE/ciao/Swapping_Container.cpp index 087e269815b..18c4f4ed71c 100644 --- a/TAO/CIAO/DAnCE/ciao/Swapping_Container.cpp +++ b/TAO/CIAO/DAnCE/ciao/Swapping_Container.cpp @@ -32,6 +32,12 @@ namespace CIAO return this->home_servant_poa_.in (); } + PortableServer::POA_ptr + Swapping_Container::the_facet_cons_POA (void) const + { + return this->facet_cons_poa_.in (); + } + CORBA::Object_ptr Swapping_Container::get_home_objref (PortableServer::Servant p ACE_ENV_ARG_DECL) @@ -41,6 +47,16 @@ namespace CIAO ACE_ENV_ARG_PARAMETER); } + void + Swapping_Container::deactivate_facet (PortableServer::ObjectId &oid + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->the_facet_cons_POA ()->deactivate_object (oid + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + int Swapping_Container::init (const char *name, const CORBA::PolicyList *more_policies diff --git a/TAO/CIAO/DAnCE/ciao/Swapping_Container.h b/TAO/CIAO/DAnCE/ciao/Swapping_Container.h index 3372d356b3e..7f822143845 100644 --- a/TAO/CIAO/DAnCE/ciao/Swapping_Container.h +++ b/TAO/CIAO/DAnCE/ciao/Swapping_Container.h @@ -74,8 +74,14 @@ namespace CIAO virtual void delete_servant_map (PortableServer::ObjectId &oid ACE_ENV_ARG_DECL); + virtual void deactivate_facet (PortableServer::ObjectId &oid + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + PortableServer::POA_ptr the_home_servant_POA (void) const; + PortableServer::POA_ptr the_facet_cons_POA (void) const; + private: /// Create POA for the component. diff --git a/TAO/CIAO/DAnCE/examples/Hello/Sender/SenderE.idl.new_impl b/TAO/CIAO/DAnCE/examples/Hello/Sender/SenderE.idl.new_impl index 7237ecb64fd..0ade2d3a1d0 100644 --- a/TAO/CIAO/DAnCE/examples/Hello/Sender/SenderE.idl.new_impl +++ b/TAO/CIAO/DAnCE/examples/Hello/Sender/SenderE.idl.new_impl @@ -37,8 +37,10 @@ module Hello local interface CCM_Sender_Context : ::Components::SessionContext { void push_click_out (in ::Hello::TimeOut e); - ::Components::ConsumerDescriptions get_registered_consumer + ::Components::ConsumerDescriptions get_registered_consumers (in ::Components::FeatureName publisher_name); + void deactivate_facet (in ::Components::FeatureName name); + void update_port_activator (in ::Components::FeatureName name); }; local interface CCM_SenderHomeImplicit diff --git a/TAO/CIAO/DAnCE/examples/Hello/Sender/Sender_exec_1.cpp b/TAO/CIAO/DAnCE/examples/Hello/Sender/Sender_exec_1.cpp index f5e8fa6b1ad..bf5fb58377b 100644 --- a/TAO/CIAO/DAnCE/examples/Hello/Sender/Sender_exec_1.cpp +++ b/TAO/CIAO/DAnCE/examples/Hello/Sender/Sender_exec_1.cpp @@ -2,6 +2,7 @@ #include "Sender_exec_1.h" #include "Sender_exec.h" +#include "ciao/Servant_Activator.h" char* Sender_Impl::Message_Impl_1::get_message (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) @@ -109,9 +110,11 @@ Sender_Impl::Sender_exec_1_i::ccm_passivate (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_ENV_ARG_PARAMETER); Components::ConsumerDescriptions_var retval = - this->context_->get_registered_consumer ("click_out" + this->context_->get_registered_consumers ("click_out" ACE_ENV_ARG_PARAMETER); this->base_exec_->consumers (retval._retn ()); + this->context_->deactivate_facet ("Hello_Sender_push_message"); + this->context_->update_port_activator ("Hello_Sender_push_message"); /* ::Components::ConsumerDescriptions_var cons_desc = sender->get_all_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); diff --git a/TAO/CIAO/DAnCE/examples/Hello/Sender/Sender_svnt.cpp.with-connections b/TAO/CIAO/DAnCE/examples/Hello/Sender/Sender_svnt.cpp.with-connections index 9d096ae8202..2f25588a3f5 100644 --- a/TAO/CIAO/DAnCE/examples/Hello/Sender/Sender_svnt.cpp.with-connections +++ b/TAO/CIAO/DAnCE/examples/Hello/Sender/Sender_svnt.cpp.with-connections @@ -104,12 +104,38 @@ namespace Sender_Impl // Operations for Sender receptacles and event sources, // defined in ::Hello::CCM_Sender_Context. + void + Sender_Context::update_port_activator ( + const char* obj_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + PortableServer::ObjectId_var oid = + PortableServer::string_to_ObjectId (obj_id); + CIAO::Servant_Activator *sa = + this->container_->ports_servant_activator (); + sa->update_port_activator (oid); + } + + void + Sender_Context::deactivate_facet ( + const char* obj_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + PortableServer::ObjectId_var oid = + PortableServer::string_to_ObjectId (obj_id); + + this->container_->deactivate_facet (oid); + } + ::Components::ConsumerDescriptions * - Sender_Context::get_registered_consumer ( + Sender_Context::get_registered_consumers ( const char* publisher_name ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { + ACE_UNUSED_ARG (publisher_name); ::Components::ConsumerDescriptions *tmp = 0; ACE_NEW_THROW_EX (tmp, ::Components::ConsumerDescriptions @@ -298,18 +324,7 @@ namespace Sender_Impl const ::Components::ConfigValues &descr ACE_ENV_ARG_DECL_NOT_USED) { - if (this->is_activated () == 0) - { - this->ciao_preactivate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - - this->ciao_activate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - - this->ciao_postactivate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - } - + this->activate_component (); for (CORBA::ULong i = 0; i < descr.length (); ++i) @@ -335,18 +350,7 @@ namespace Sender_Impl ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - if (this->is_activated () == 0) - { - this->ciao_preactivate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - - this->ciao_activate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - - this->ciao_postactivate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - } - + this->activate_component (); if (! ::CORBA::is_nil (this->provide_push_message_.in ())) { return ::Hello::ReadMessage::_duplicate (this->provide_push_message_.in ()); @@ -436,18 +440,7 @@ namespace Sender_Impl ::CORBA::SystemException, ::Components::ExceededConnectionLimit)) { - if (this->is_activated () == 0) - { - this->ciao_preactivate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - - this->ciao_activate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - - this->ciao_postactivate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - } - + this->activate_component (); return this->context_->subscribe_click_out ( c ACE_ENV_ARG_PARAMETER); @@ -461,18 +454,7 @@ namespace Sender_Impl ::CORBA::SystemException, ::Components::InvalidConnection)) { - if (this->is_activated () == 0) - { - this->ciao_preactivate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - - this->ciao_activate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - - this->ciao_postactivate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - } - + this->activate_component (); return this->context_->unsubscribe_click_out ( ck ACE_ENV_ARG_PARAMETER); @@ -490,18 +472,7 @@ namespace Sender_Impl ::Components::AlreadyConnected, ::Components::ExceededConnectionLimit)) { - if (this->is_activated () == 0) - { - this->ciao_preactivate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - - this->ciao_activate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - - this->ciao_postactivate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - } - + this->activate_component (); // If the component has no receptacles, this will be unused. ACE_UNUSED_ARG (connection); @@ -525,18 +496,7 @@ namespace Sender_Impl ::Components::CookieRequired, ::Components::NoConnection)) { - if (this->is_activated () == 0) - { - this->ciao_preactivate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - - this->ciao_activate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - - this->ciao_postactivate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - } - + this->activate_component (); if (name == 0) { ACE_THROW_RETURN ( @@ -562,18 +522,7 @@ namespace Sender_Impl ::Components::AlreadyConnected, ::Components::InvalidConnection)) { - if (this->is_activated () == 0) - { - this->ciao_preactivate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - - this->ciao_activate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - - this->ciao_postactivate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - } - + this->activate_component (); if (emitter_name == 0) { ACE_THROW (::CORBA::BAD_PARAM ()); @@ -594,18 +543,7 @@ namespace Sender_Impl ::Components::InvalidConnection, ::Components::ExceededConnectionLimit)) { - if (this->is_activated () == 0) - { - this->ciao_preactivate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - - this->ciao_activate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - - this->ciao_postactivate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - } - + this->activate_component (); // Just in case there are no if blocks ACE_UNUSED_ARG (subscribe); @@ -645,18 +583,7 @@ namespace Sender_Impl ::Components::InvalidName, ::Components::InvalidConnection)) { - if (this->is_activated () == 0) - { - this->ciao_preactivate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - - this->ciao_activate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - - this->ciao_postactivate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - } - + this->activate_component (); // Just in case there are no if blocks ACE_UNUSED_ARG (ck); @@ -685,18 +612,7 @@ namespace Sender_Impl ACE_THROW_SPEC (( ::CORBA::SystemException)) { - if (this->is_activated () == 0) - { - this->ciao_preactivate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - - this->ciao_activate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - - this->ciao_postactivate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - } - + this->activate_component (); if (name == 0) { ACE_THROW_RETURN ( @@ -719,18 +635,7 @@ namespace Sender_Impl ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - if (this->is_activated () == 0) - { - this->ciao_preactivate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - - this->ciao_activate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - - this->ciao_postactivate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - } - + this->activate_component (); this->executor_->start ( ACE_ENV_SINGLE_ARG_PARAMETER); } @@ -742,18 +647,7 @@ namespace Sender_Impl ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - if (this->is_activated () == 0) - { - this->ciao_preactivate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - - this->ciao_activate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - - this->ciao_postactivate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - } - + this->activate_component (); return this->executor_->local_message ( ACE_ENV_SINGLE_ARG_PARAMETER); } @@ -764,18 +658,7 @@ namespace Sender_Impl ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - if (this->is_activated () == 0) - { - this->ciao_preactivate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - - this->ciao_activate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - - this->ciao_postactivate ( - ACE_ENV_SINGLE_ARG_PARAMETER); - } - + this->activate_component (); this->executor_->local_message ( local_message ACE_ENV_ARG_PARAMETER); diff --git a/TAO/CIAO/DAnCE/examples/Hello/Sender/Sender_svnt.h.with-connections b/TAO/CIAO/DAnCE/examples/Hello/Sender/Sender_svnt.h.with-connections index 97b425d6dfa..b6d834eba77 100644 --- a/TAO/CIAO/DAnCE/examples/Hello/Sender/Sender_svnt.h.with-connections +++ b/TAO/CIAO/DAnCE/examples/Hello/Sender/Sender_svnt.h.with-connections @@ -121,10 +121,20 @@ namespace Sender_Impl ACE_THROW_SPEC ((CORBA::SystemException)); virtual ::Components::ConsumerDescriptions * - get_registered_consumer (const char *publisher_name + get_registered_consumers (const char *publisher_name ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); + virtual void + deactivate_facet (const char *obj_id + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void + update_port_activator (const char *obj_id + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + // CIAO-specific. static Sender_Context * |