diff options
Diffstat (limited to 'TAO/orbsvcs/Notify_Service/Notify_Service.cpp')
-rw-r--r-- | TAO/orbsvcs/Notify_Service/Notify_Service.cpp | 63 |
1 files changed, 30 insertions, 33 deletions
diff --git a/TAO/orbsvcs/Notify_Service/Notify_Service.cpp b/TAO/orbsvcs/Notify_Service/Notify_Service.cpp index ffa2953f1fa..33d5479eb48 100644 --- a/TAO/orbsvcs/Notify_Service/Notify_Service.cpp +++ b/TAO/orbsvcs/Notify_Service/Notify_Service.cpp @@ -2,18 +2,18 @@ #include "Notify_Service.h" #include "tao/debug.h" -#include "orbsvcs/Notify/Notify_EventChannelFactory_i.h" -#include "orbsvcs/Notify/Notify_Default_CO_Factory.h" -#include "orbsvcs/Notify/Notify_Default_POA_Factory.h" -#include "orbsvcs/Notify/Notify_Default_Collection_Factory.h" -#include "orbsvcs/Notify/Notify_Default_EMO_Factory.h" #include "tao/IORTable/IORTable.h" #include "ace/Arg_Shifter.h" #include "ace/Get_Opt.h" +#include "ace/Sched_Params.h" +#include "ace/Synch.h" #include "ace/Argv_Type_Converter.h" +#include "tao/ORB_Core.h" +#include "ace/Dynamic_Service.h" TAO_Notify_Service::TAO_Notify_Service (void) - : bootstrap_ (0), + : notify_service_ (0), + bootstrap_ (0), use_name_svc_ (1), ior_output_file_ (0), notify_factory_name_ (NOTIFY_KEY), @@ -43,18 +43,26 @@ TAO_Notify_Service::init_ORB (int& argc, ACE_TCHAR *argv [] ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (-1); - CORBA::Object_var poa_obj = + this->notify_service_ = ACE_Dynamic_Service<TAO_NS_Service>::instance (TAO_NS_COS_NOTIFICATION_SERVICE_NAME); + + if (this->notify_service_ == 0) + { + ACE_DEBUG ((LM_DEBUG, "Service not found! check conf. file\n")); + return -1; + } + + CORBA::Object_var object = this->orb_->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (-1); - if (CORBA::is_nil (poa_obj.in ())) + if (CORBA::is_nil (object.in ())) ACE_ERROR_RETURN ((LM_ERROR, " (%P|%t) Unable to resolve the RootPOA.\n"), -1); this->poa_ = - PortableServer::POA::_narrow (poa_obj.in () + PortableServer::POA::_narrow (object.in () ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (-1); @@ -77,6 +85,7 @@ TAO_Notify_Service::init (int argc, ACE_TCHAR *argv[] ACE_ENV_ARG_PARAMETER) != 0) return -1; + this->notify_service_->init (this->orb_.in () ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (-1); if (this->parse_args(argc, argv) != 0) @@ -108,8 +117,8 @@ TAO_Notify_Service::init (int argc, ACE_TCHAR *argv[] // Activate the factory this->notify_factory_ = - TAO_Notify_EventChannelFactory_i::create (this->poa_.in () - ACE_ENV_ARG_PARAMETER); + notify_service_->create (this->poa_.in () + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (-1); ACE_ASSERT (!CORBA::is_nil (this->notify_factory_.in ())); @@ -269,7 +278,7 @@ TAO_Notify_Service::resolve_naming_service (ACE_ENV_SINGLE_ARG_DECL) } int -TAO_Notify_Service::run () +TAO_Notify_Service::run (ACE_ENV_SINGLE_ARG_DECL) { if (TAO_debug_level > 0 ) ACE_DEBUG ((LM_DEBUG, "%s: Running the Notification Service\n", @@ -281,17 +290,8 @@ TAO_Notify_Service::run () return 0; } - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - this->orb_->run (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "run"), -1); - } - ACE_ENDTRY; + this->orb_->run (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); return 0; } @@ -300,16 +300,6 @@ void TAO_Notify_Service::shutdown (ACE_ENV_SINGLE_ARG_DECL) { // Deactivate. - PortableServer::ObjectId_var oid = - this->poa_->reference_to_id (this->notify_factory_.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - // deactivate from the poa. - this->poa_->deactivate_object (oid.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - if (this->use_name_svc_) { // Unbind from the naming service. @@ -339,6 +329,12 @@ TAO_Notify_Service::shutdown (ACE_ENV_SINGLE_ARG_DECL) // shutdown the ORB. if (!CORBA::is_nil (this->orb_.in ())) this->orb_->shutdown (); + + /// Release all the _vars as the ORB is gone now. + notify_factory_._retn (); + orb_._retn (); + poa_._retn (); + naming_._retn (); } int @@ -447,6 +443,7 @@ Worker::svc (void) { this->orb_->run (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; + } ACE_CATCHANY { |