diff options
Diffstat (limited to 'TAO/orbsvcs/CosEvent_Service/CosEvent_Service.cpp')
-rw-r--r-- | TAO/orbsvcs/CosEvent_Service/CosEvent_Service.cpp | 715 |
1 files changed, 542 insertions, 173 deletions
diff --git a/TAO/orbsvcs/CosEvent_Service/CosEvent_Service.cpp b/TAO/orbsvcs/CosEvent_Service/CosEvent_Service.cpp index cf87f55089f..f55d35acbf9 100644 --- a/TAO/orbsvcs/CosEvent_Service/CosEvent_Service.cpp +++ b/TAO/orbsvcs/CosEvent_Service/CosEvent_Service.cpp @@ -2,12 +2,24 @@ #include "ace/Get_Opt.h" #include "CosEvent_Service.h" -#include "orbsvcs/Event/EC_Default_Factory.h" + +// @@ Pradeep: somehow the user should be able to specify if the EC is +// to be instantiated locally or if you want to use a remote EC. +// Please check the real-time Event_Service and how they manage +// optionally create a scheduling service. CosEvent_Service::CosEvent_Service (void) : service_name ("CosEventService"), rt_service_name ("EventService"), - remote_Rtec_ (0) + schedule_name_ ("ScheduleService"), + scheduler_ (RtecScheduler::Scheduler::_nil ()), + rtec_ (RtecEventChannelAdmin::EventChannel::_nil ()), + cos_ec_ (CosEventChannelAdmin::EventChannel::_nil ()), + global_scheduler_ (0), + remote_Rtec_ (1), + eventTypeIds_ (0), + eventSourceIds_ (0), + source_type_pairs_ (0) { // No-Op. } @@ -17,38 +29,60 @@ CosEvent_Service::~CosEvent_Service (void) // No-Op. } -void -CosEvent_Service::init_ORB (int argc, char *argv [], - CORBA::Environment &ACE_TRY_ENV) +int +CosEvent_Service::init_ORB (int argc, char *argv []) { - this->orb_ = CORBA::ORB_init (argc, - argv, - "", - ACE_TRY_ENV); - ACE_CHECK; - - CORBA::Object_var poa_object = - this->orb_->resolve_initial_references("RootPOA", - ACE_TRY_ENV); - ACE_CHECK; + ACE_DECLARE_NEW_CORBA_ENV; + ACE_TRY + { + this->orb_ = CORBA::ORB_init (argc, + argv, + "", + ACE_TRY_ENV); + ACE_TRY_CHECK; - this->poa_ = - PortableServer::POA::_narrow (poa_object.in (), - ACE_TRY_ENV); - ACE_CHECK; + CORBA::Object_var poa_object = + this->orb_->resolve_initial_references("RootPOA", + ACE_TRY_ENV); + ACE_TRY_CHECK; + + if (CORBA::is_nil (poa_object.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Unable to initialize the POA.\n"), + -1); + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; - PortableServer::POAManager_var poa_manager = - this->poa_->the_POAManager (ACE_TRY_ENV); - ACE_CHECK; + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (ACE_TRY_ENV); + + ACE_TRY_CHECK; + + poa_manager->activate (ACE_TRY_ENV); + + ACE_TRY_CHECK; + + return 0; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Exception in CosEvent_Service::init_ORB"); + return -1; + } + ACE_ENDTRY; + ACE_CHECK_RETURN (-1); - poa_manager->activate (ACE_TRY_ENV); - ACE_CHECK; + ACE_NOTREACHED (return 0;) } int CosEvent_Service::parse_args (int argc, char *argv []) { - ACE_Get_Opt get_opt (argc, argv, "t:n:e:o:p:r"); + ACE_Get_Opt get_opt (argc, argv, "r:n:s:e:o:p:l"); int opt; while ((opt = get_opt ()) != EOF) @@ -59,12 +93,32 @@ CosEvent_Service::parse_args (int argc, char *argv []) this->service_name = get_opt.optarg; break; - case 't': + case 'r': this->rt_service_name = get_opt.optarg; break; - case 'r': - this->remote_Rtec_ = 1; + case 's': + if (ACE_OS::strcasecmp (get_opt.optarg, "global") == 0) + { + this->global_scheduler_ = 1; + } + else if (ACE_OS::strcasecmp (get_opt.optarg, "local") == 0) + { + this->global_scheduler_ = 0; + } + else + { + ACE_DEBUG ((LM_DEBUG, + "Unknown scheduling type <%s> " + "defaulting to local\n", + get_opt.optarg)); + this->global_scheduler_ = 0; + return -1; + } + break; + + case 'l': + this->remote_Rtec_ = 0; break; case 'e': @@ -83,13 +137,14 @@ CosEvent_Service::parse_args (int argc, char *argv []) default: ACE_DEBUG ((LM_DEBUG, "Usage: %s " - "\n\t-n <COS Event Service name>" - "\n\t-t <RealTime Event Service name>" - "\n\t-r" // creates the RtEC locally. - "\n\t-e [\"EventType_1, EventType_2...\"] for ConsumerQOS." - "\n\t-o [\"EventSourceID_1, [EventSourceID_2...\"] for ConsumerQOS." - "\n\t-p [\"Source, Event\" pairs] for SupplierQOS." - "\n", + " -n <COS Event Service name>" + " -r <RealTime Event Service name>" + " -s <global|local>" + " -l" // creates the RtEC locally. + " -e [\"EventType_1, EventType_2...\"] for ConsumerQOS." + " -o [\"EventSourceID_1, [EventSourceID_2...\"] for ConsumerQOS." + " -p [\"Source, Event\" pair] for SupplierQOS." + " \n", argv[0])); return -1; } @@ -98,204 +153,518 @@ CosEvent_Service::parse_args (int argc, char *argv []) return 0; } -void -CosEvent_Service::startup (int argc, char *argv[], - CORBA::Environment &ACE_TRY_ENV) +int +CosEvent_Service::init_NamingService (void) { - ACE_DEBUG ((LM_DEBUG, - "Starting up the CosEvent Service...\n")); + // Initialization of the naming service. + if (this->naming_client_.init (this->orb_.in ()) != 0) + ACE_ERROR_RETURN ((LM_ERROR, + "(%P|%t) Unable to initialize " + "the TAO_Naming_Client. \n"), + -1); + return 0; +} - // initalize the ORB. - this->init_ORB (argc, argv, - ACE_TRY_ENV); - ACE_CHECK; +int +CosEvent_Service::get_Rtec_viaNamingService (void) +{ + ACE_DECLARE_NEW_CORBA_ENV; + ACE_TRY + { + CosNaming::Name rt_ref_name (1); // name of the RT Event service. + rt_ref_name.length (1); + rt_ref_name[0].id = + CORBA::string_dup (this->rt_service_name); + + CORBA::Object_var rtEC_obj = + this->naming_client_->resolve (rt_ref_name, + ACE_TRY_ENV); + ACE_TRY_CHECK; - this->resolve_naming_service (ACE_TRY_ENV); - ACE_CHECK; + // The CORBA::Object_var object is downcast to + // RtecEventChannelAdmin::EventChannel + // using the <_narrow> method. + this->rtec_ = + RtecEventChannelAdmin::EventChannel::_narrow (rtEC_obj.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; - this->init (this->poa_, - this->poa_, - this->eventTypeIds_, - this->eventSourceIds_, - this->source_type_pairs_, - ACE_TRY_ENV); - ACE_CHECK; + return 0; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Exception in CosEvent_Service::get_Rtec_viaNamingService\n"); + return -1; + } + ACE_ENDTRY; + ACE_CHECK_RETURN (-1); - this->activate (ACE_TRY_ENV); - ACE_CHECK; + ACE_NOTREACHED (return 0;) +} - // Register ourselves with the naming service. - ACE_ASSERT(!CORBA::is_nil (this->naming_.in ())); +int +CosEvent_Service::start_Scheduler (void) +{ + ACE_DECLARE_NEW_CORBA_ENV; + ACE_TRY + { + if (this->global_scheduler_ == 0) + { + this->scheduler_ = + this->scheduler_impl_._this (ACE_TRY_ENV); + ACE_TRY_CHECK; - CORBA::Object_var obj = - this->poa_->servant_to_reference (this, - ACE_TRY_ENV); - ACE_CHECK; + CORBA::String_var str = + this->orb_->object_to_string (this->scheduler_.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; - CORBA::String_var str = - this->orb_->object_to_string (obj.in (), ACE_TRY_ENV); + ACE_DEBUG ((LM_DEBUG, + "CosEvent_Service: The (local) scheduler IOR is <%s>\n", + str.in ())); - ACE_DEBUG ((LM_DEBUG, - "The CosEC IOR is <%s>\n", str.in ())); + if (ACE_Scheduler_Factory::server (this->scheduler_.in ()) == -1) + return -1; + } + else // get the global scheduler + { + CosNaming::Name schedule_name (1); + schedule_name.length (1); + schedule_name[0].id = CORBA::string_dup (this->schedule_name_); + + CORBA::Object_var sched_obj = + this->naming_client_->resolve (schedule_name, + ACE_TRY_ENV); + ACE_TRY_CHECK; - CosNaming::Name name (1); - name.length (1); - name[0].id = CORBA::string_dup (this->service_name); + // The CORBA::Object_var object is downcast to + // RtecScheduler::Scheduler using the <_narrow> method. + this->scheduler_ = + RtecScheduler::Scheduler::_narrow (sched_obj.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; - this->naming_->rebind (name, - obj.in (), - ACE_TRY_ENV); - ACE_CHECK; + if (ACE_Scheduler_Factory::server (this->scheduler_.in ()) == -1) + return -1; + } + + ACE_Scheduler_Factory::use_config (this->naming_client_.get_context()); + return 0; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Exception in CosEvent_Service::start_Scheduler\n"); + return -1; + } + ACE_ENDTRY; + ACE_CHECK_RETURN (-1); - ACE_DEBUG ((LM_DEBUG, - "Registered with the naming service as: %s\n", - this->service_name)); + ACE_NOTREACHED (return 0;) } +int +CosEvent_Service::create_local_RtecService (void) +{ + ACE_DECLARE_NEW_CORBA_ENV; + ACE_TRY + { + ACE_NEW_RETURN (this->ec_impl_, + ACE_EventChannel(0, + ACE_DEFAULT_EVENT_CHANNEL_TYPE, + &module_factory_), -1); + + this->rtec_ = this->ec_impl_->_this (ACE_TRY_ENV); + ACE_TRY_CHECK; + + CORBA::String_var str = this->orb_->object_to_string (this->rtec_.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; -POA_RtecEventChannelAdmin::EventChannel_ptr -CosEvent_Service::create_rtec (CORBA::Environment &ACE_TRY_ENV) + ACE_DEBUG ((LM_DEBUG, + "CosEvent_Service: The RTEC IOR is <%s>\n", + str.in ())); + + this->ec_impl_->activate (); + + return 0; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Exception in CosEvent_Service::create_local_RtecService\n"); + return -1; + } + ACE_ENDTRY; + ACE_CHECK_RETURN (-1); + + ACE_NOTREACHED (return 0;) +} + +void +CosEvent_Service::init_SupplierQOS (RtecScheduler::handle_t supp_handle) { - // see if the user wants a local Rtec.. - if (this->remote_Rtec_ == 0) - return CosEC_ServantBase::create_rtec (ACE_TRY_ENV); - else - return 0; + // @@ Pradeep: It is very important that you make the type of + // events generated by the CosEC an option. + // I know this is not very well documented, but the type should + // be >= ACE_ES_EVENT_UNDEFINED = 16 + // Something else: please make the EventSourceID for the + // supplier also an option... + + char c = ' '; // space + char *tok = 0; + + // if nothing was specified on the command line use defaults.. + if (this->source_type_pairs_ == 0) + this->supplier_qos_.insert (1, + ACE_ES_EVENT_ANY, + supp_handle, + 1); + else // parse the event types.. + { + tok = ACE_OS::strtok (this->source_type_pairs_, &c); + if (tok == 0) // error + { + ACE_DEBUG ((LM_DEBUG, "error parsing source,event pairs for SupplierQOS, defaulting to source id = 1, eventid = ACE_ES_EVENT_ANY")); + + this->supplier_qos_.insert (1, + ACE_ES_EVENT_ANY, + supp_handle, + 1); + } + else + // we just use 1 source-type pair in the event channel. + // so scan for the 1st pair only. + { + int source_val = 0, type_val = 0; + source_val = ACE_OS::atoi (tok); + + tok = ACE_OS::strtok (0, &c); + + if (tok != 0) + type_val = ACE_OS::atoi (tok); + + ACE_DEBUG ((LM_DEBUG, "supplier_qos::insert (%d, %d)\n", + source_val, type_val)); + + // Setup the QOS params.. + this->supplier_qos_.insert (source_val, + type_val, + supp_handle, + 1); + } + } } void -CosEvent_Service::activate_rtec (CORBA::Environment &ACE_TRY_ENV) +CosEvent_Service::init_ConsumerQOS (RtecScheduler::handle_t cons_handle) { - // see if the user wants to use a local Rtec.. - if (this->remote_Rtec_ == 0) + // @@ Pradeep: ditto here, make the set of sources (and/or type) + // a parameter, and make sure the user can specify multiple of + // them (just call insert_source() or insert_type() in the + // parse_args routine). + + char c = ' '; // space + char *tok = 0; + + this->consumer_qos_.start_disjunction_group (); + + // insert the event ids first.. + + // if nothing was specified on the command line use defaults.. + if (this->eventTypeIds_ == 0) { - CosEC_ServantBase::activate_rtec (ACE_TRY_ENV); - ACE_CHECK; + //this->consumer_qos_.insert_type (ACE_ES_EVENT_ANY, // default + // cons_handle); + // @@ if i uncomment this line then the Rtec displays the message + // "Consumer tried to register for allevents! This is not implemented." + // whenever a consumer tries to register with it. } - else + else // parse the event types.. + { + tok = ACE_OS::strtok ( this->eventTypeIds_, &c); + if (tok == 0) // error + { + ACE_DEBUG ((LM_DEBUG, "error parsing eventIds for ConsumerQOS, defaulting to 1")); + this->consumer_qos_.insert_type (ACE_ES_EVENT_ANY, + cons_handle); + } + else + do + { + int type_val = ACE_OS::atoi (tok); + ACE_DEBUG ((LM_DEBUG, "consumer_qos::insert_type (%d)\n", + type_val)); + this->consumer_qos_.insert_type (type_val, + cons_handle); + tok = ACE_OS::strtok (0, &c); + } + while (tok != 0); + } + + // repeat for source ids.. + + // if nothing was specified on the command line use defaults.. + if (this->eventSourceIds_ == 0) + this->consumer_qos_.insert_source (1, // default = 1 + cons_handle); + else // parse the event types.. { - // Try to locate a remote rtec. - this->locate_rtec (ACE_TRY_ENV); - ACE_CHECK; - - // Use the return value to check success. - if (CORBA::is_nil (this->rtec_.in ())) - ACE_DEBUG ((LM_DEBUG, - "Could not locate a RT EventChannel.Please start one and try again\n")); - ACE_CHECK; + tok = ACE_OS::strtok (this->eventSourceIds_, &c); + if (tok == 0) // error + { + ACE_DEBUG ((LM_DEBUG, "error parsing sourceIds for ConsumerQOS, defaulting to 1")); + this->consumer_qos_.insert_source (1, // default = 1 + cons_handle); + } + else + do + { + int source_val = ACE_OS::atoi (tok); + ACE_DEBUG ((LM_DEBUG, "consumer_qos::insert_source (%d)\n", + source_val)); + this->consumer_qos_.insert_type (source_val, + cons_handle); + tok = ACE_OS::strtok (0, &c); + } + while (tok != 0); } } -void -CosEvent_Service::deactivate_rtec (CORBA::Environment &ACE_TRY_ENV) +int +CosEvent_Service::create_CosEC (void) { - // Check if the local rtec is to be deactivated. - if (this->remote_Rtec_ == 0) + ACE_DECLARE_NEW_CORBA_ENV; + ACE_TRY + { + RtecScheduler::handle_t supp_handle = + this->scheduler_->create ("supplier", + ACE_TRY_ENV); + + ACE_TRY_CHECK; + + this->init_SupplierQOS (supp_handle); + + RtecScheduler::handle_t cons_handle = + this->scheduler_->create ("consumer", + ACE_TRY_ENV); + ACE_TRY_CHECK; + + this->init_ConsumerQOS (cons_handle); + + const RtecEventChannelAdmin::ConsumerQOS &consumerqos = + this->consumer_qos_.get_ConsumerQOS (); + + const RtecEventChannelAdmin::SupplierQOS &supplierqos = + this->supplier_qos_.get_SupplierQOS (); + + if (this->ec_i_.init (consumerqos, + supplierqos, + this->rtec_.in (), + ACE_TRY_ENV) != 0) + return -1; + + ACE_TRY_CHECK; + + this->cos_ec_ = this->ec_i_._this (ACE_TRY_ENV); + ACE_TRY_CHECK; + + CORBA::String_var str = this->orb_->object_to_string (this->cos_ec_, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + ACE_DEBUG ((LM_DEBUG, + "CosEvent_Service: The COSEC IOR is <%s>\n", + str.in ())); + return 0; + } + ACE_CATCHANY { - CosEC_ServantBase::deactivate_rtec (ACE_TRY_ENV); - ACE_CHECK; + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Exception in CosEvent_Service::create_CosEC"); + return -1; } + ACE_ENDTRY; + ACE_CHECK_RETURN (-1); + + ACE_NOTREACHED (return 0;) } -void -CosEvent_Service::locate_rtec (CORBA::Environment &ACE_TRY_ENV) +int +CosEvent_Service::register_CosEC (void) { - CosNaming::Name ref_name (1); - ref_name.length (1); - ref_name[0].id = - CORBA::string_dup (this->rt_service_name); - - CORBA::Object_var obj = - this->naming_->resolve (ref_name, - ACE_TRY_ENV); - ACE_CHECK; - - this->rtec_ = - RtecEventChannelAdmin::EventChannel::_narrow (obj.in (), - ACE_TRY_ENV); - ACE_CHECK; + ACE_DECLARE_NEW_CORBA_ENV; + ACE_TRY + { + // Name the object. + CosNaming::Name ec_obj_name (1); + ec_obj_name.length (1); + ec_obj_name[0].id = + CORBA::string_dup (this->service_name); + + // Now, attach the object name to the context. + this->naming_client_->rebind (ec_obj_name, + this->cos_ec_, + ACE_TRY_ENV); + ACE_TRY_CHECK; + return 0; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Exception in CosEvent_Service::register_CosEC.\n"); + return -1; + } + ACE_ENDTRY; + ACE_CHECK_RETURN (-1); + + ACE_NOTREACHED (return 0;) } -void -CosEvent_Service::resolve_naming_service (CORBA::Environment &ACE_TRY_ENV) +int +CosEvent_Service::startup (int argc, char *argv[]) { - CORBA::Object_var naming_obj = - this->orb_->resolve_initial_references ("NameService", - ACE_TRY_ENV); - ACE_CHECK; - - // Need to check return value for errors. - if (CORBA::is_nil (naming_obj.in ())) - ACE_THROW (CORBA::UNKNOWN ()); - - this->naming_ = - CosNaming::NamingContext::_narrow (naming_obj.in (), - ACE_TRY_ENV); - ACE_CHECK; + // initalize the ORB. + if (this->init_ORB (argc, argv) == -1) + return -1; + + // The ORB is initialized before <parse_args> because the ACE_Channel + // <destroy> method assumes an initialized ORB. + + // check command line args. + if (this->parse_args (argc, argv) == -1) + return -1; + + // initialize the Naming Client. + if (this->init_NamingService () == -1) + return -1; + + // start the scheduler + if (this->start_Scheduler ()) + { + // scheduler startup failed..cleanup + this->shutdown (); + ACE_ERROR_RETURN ((LM_ERROR, + "(%P|%t) Failed to start the scheduler\n"), + -1); + } + + // see if the user wants a local Rtec.. + if (this->remote_Rtec_ == 0 && this->create_local_RtecService () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Failed to create a local RtEC.\n"), + -1); + } + else + // get hold of the Rtec Service via the Naming Service. + if (this->get_Rtec_viaNamingService () == -1) + { + ACE_DEBUG ((LM_ERROR, "Could not locate the Real Time Event service <%s> via the Naming Service, trying to create a local copy..\n", this->rt_service_name)); + + // Rtec was not active.. try creating a local copy. + if (this->create_local_RtecService () == -1) + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Failed to create a local RtEC.\n"), + -1); + } + + + // now try to create the COS EC. + if (this->create_CosEC () == -1) + { + // CosEC creation failed.. cleanup + this->shutdown (); + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Failed to create CosEC.\n"), + -1); + } + + // finally, register it with the naming service. + if (this->register_CosEC () == -1) + { + // CosEC registration failed.. cleanup + this->shutdown (); + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Failed to register the CosEC with the naming service.\n"), + -1); + } + + return 0; } int CosEvent_Service::run (void) { - ACE_DEBUG ((LM_DEBUG, "%s: Running the CosEventService\n", __FILE__)); + ACE_DEBUG ((LM_DEBUG, "%s; running the Cos event service\n", __FILE__)); if (this->orb_->run () == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "run"), 1); return 0; } -void -CosEvent_Service::shutdown (CORBA::Environment &ACE_TRY_ENV) +int +CosEvent_Service::shutdown (void) { - // Deactivate. - this->deactivate (ACE_TRY_ENV); - ACE_CHECK; + ACE_DECLARE_NEW_CORBA_ENV; + ACE_TRY + { + if (!this->cos_ec_->_nil ()) + { + // unbind the cosEC from the naming service. + CosNaming::Name ec_obj_name (1); + ec_obj_name.length (1); + ec_obj_name[0].id = + CORBA::string_dup (this->service_name); + this->naming_client_->unbind (ec_obj_name, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + this->cos_ec_->destroy (ACE_TRY_ENV); + ACE_TRY_CHECK; + } + + this->ec_impl_->shutdown (); + delete ec_impl_; - // Unbind from the naming service. - CosNaming::Name name (1); - name.length (1); - name[0].id = CORBA::string_dup (this->service_name); + // shutdown the ORB. + if (!this->orb_->_nil ()) + this->orb_->shutdown (); - this->naming_->unbind (name, - ACE_TRY_ENV); + return 0; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Exception in shutdown.\n"); + return -1; + } + ACE_ENDTRY; + ACE_CHECK_RETURN (-1); - // shutdown the ORB. - if (!CORBA::is_nil (this->orb_.in ())) - this->orb_->shutdown (); + ACE_NOTREACHED (return 0;) } int main (int argc, char *argv[]) { - TAO_EC_Default_Factory::init_svcs (); - CosEvent_Service service; - // check command line args. - if (service.parse_args (argc, argv) == -1) - return 1; - - ACE_TRY_NEW_ENV + if (service.startup (argc, argv) == -1) { - service.startup (argc, - argv, - ACE_TRY_ENV); - ACE_TRY_CHECK; - - if (service.run () == -1) - { - service.shutdown (); - ACE_ERROR_RETURN ((LM_ERROR, - "Failed to run the CosEventService.\n"), - 1); - } + service.shutdown (); + ACE_ERROR_RETURN ((LM_ERROR, + "Failed to setup the Cos Event Channel.\n"), + 1); } - ACE_CATCHANY + + if (service.run () == -1) { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Failed to start CosEventService"); - return 1; + service.shutdown (); + ACE_ERROR_RETURN ((LM_ERROR, + "Failed to run the Cos Event Channel.\n"), + 1); } - ACE_ENDTRY; service.shutdown (); |