diff options
Diffstat (limited to 'TAO/orbsvcs/tests/Event/Mcast/Two_Way/application.cpp')
-rw-r--r-- | TAO/orbsvcs/tests/Event/Mcast/Two_Way/application.cpp | 143 |
1 files changed, 52 insertions, 91 deletions
diff --git a/TAO/orbsvcs/tests/Event/Mcast/Two_Way/application.cpp b/TAO/orbsvcs/tests/Event/Mcast/Two_Way/application.cpp index ce7c85cdd95..d93f5402332 100644 --- a/TAO/orbsvcs/tests/Event/Mcast/Two_Way/application.cpp +++ b/TAO/orbsvcs/tests/Event/Mcast/Two_Way/application.cpp @@ -56,8 +56,7 @@ public: // will not have a chance to execute, it is the responsibility of // the user.) void init (CORBA::ORB_var orb, - RtecEventChannelAdmin::EventChannel_var ec - ACE_ENV_ARG_DECL); + RtecEventChannelAdmin::EventChannel_var ec); // No-op if the object hasn't been fully initialized. Otherwise, // deregister from reactor and poa, destroy ec or just disconnect from it @@ -72,12 +71,11 @@ public: /// PushConsumer methods. //@{ /// Update our <heartbeats_> database to reflect newly received heartbeats. - virtual void push (const RtecEventComm::EventSet &events - ACE_ENV_ARG_DECL) + virtual void push (const RtecEventComm::EventSet &events) ACE_THROW_SPEC((CORBA::SystemException)); /// Initiate shutdown(). - virtual void disconnect_push_consumer (ACE_ENV_SINGLE_ARG_DECL) + virtual void disconnect_push_consumer (void) ACE_THROW_SPEC((CORBA::SystemException)); //@} @@ -107,9 +105,9 @@ private: int check_args (CORBA::ORB_var orb, RtecEventChannelAdmin::EventChannel_var ec); /// Connects to EC as a supplier. - void connect_as_supplier (ACE_ENV_SINGLE_ARG_DECL); + void connect_as_supplier (void); /// Connects to EC as a consumer. Activate with default POA. - void connect_as_consumer (ACE_ENV_SINGLE_ARG_DECL); + void connect_as_consumer (void); /// Call destroy() on the EC. Does not propagate exceptions. void destroy_ec (void); /// Registers with orb's reactor for timeouts ocurring every 0.5 @@ -221,13 +219,12 @@ Heartbeat_Application::check_args (CORBA::ORB_var orb, void Heartbeat_Application::init (CORBA::ORB_var orb, - RtecEventChannelAdmin::EventChannel_var ec - ACE_ENV_ARG_DECL) + RtecEventChannelAdmin::EventChannel_var ec) { // Verify arguments. if (this->check_args (orb, ec) == -1) { - ACE_THROW (CORBA::INTERNAL ()); + throw CORBA::INTERNAL (); } // Get hostname & process id, i.e., identity of this application. @@ -243,26 +240,22 @@ Heartbeat_Application::init (CORBA::ORB_var orb, ACE_ERROR ((LM_ERROR, "Heartbeat_Application::init - " "cannot get hostname\n")); - ACE_THROW (CORBA::INTERNAL ()); + throw CORBA::INTERNAL (); } // Connect to EC as a supplier. - this->connect_as_supplier (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; + this->connect_as_supplier (); // Connect to EC as a consumer. - ACE_TRY + try { - this->connect_as_consumer (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + this->connect_as_consumer (); } - ACE_CATCHANY + catch (const CORBA::Exception&) { this->consumer_proxy_disconnect_.execute (); - ACE_RE_THROW; + throw; } - ACE_ENDTRY; - ACE_CHECK; // Register for reactor timeouts. if (this->register_for_timeouts () == -1) @@ -270,7 +263,7 @@ Heartbeat_Application::init (CORBA::ORB_var orb, this->consumer_proxy_disconnect_.execute (); this->supplier_proxy_disconnect_.execute (); this->deactivator_.deactivate (); - ACE_THROW (CORBA::INTERNAL ()); + throw CORBA::INTERNAL (); } this->initialized_ = 1; @@ -310,26 +303,22 @@ Heartbeat_Application::stop_timeouts (void) } void -Heartbeat_Application::connect_as_supplier (ACE_ENV_SINGLE_ARG_DECL) +Heartbeat_Application::connect_as_supplier (void) { // Obtain reference to SupplierAdmin. RtecEventChannelAdmin::SupplierAdmin_var supplier_admin = - this->ec_->for_suppliers (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; + this->ec_->for_suppliers (); // Obtain ProxyPushConsumer and connect this supplier. RtecEventChannelAdmin::ProxyPushConsumer_var proxy = - supplier_admin->obtain_push_consumer (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; + supplier_admin->obtain_push_consumer (); Consumer_Proxy_Disconnect new_proxy_disconnect (proxy.in ()); ACE_SupplierQOS_Factory qos; qos.insert (SOURCE_ID, HEARTBEAT, 0, 1); proxy->connect_push_supplier (RtecEventComm::PushSupplier::_nil (), - qos.get_SupplierQOS () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; + qos.get_SupplierQOS ()); // Update resource managers. this->consumer_ = proxy._retn (); @@ -337,7 +326,7 @@ Heartbeat_Application::connect_as_supplier (ACE_ENV_SINGLE_ARG_DECL) } void -Heartbeat_Application::connect_as_consumer (ACE_ENV_SINGLE_ARG_DECL) +Heartbeat_Application::connect_as_consumer (void) { // Activate with poa. RtecEventComm::PushConsumer_var consumer_ref; @@ -347,19 +336,15 @@ Heartbeat_Application::connect_as_consumer (ACE_ENV_SINGLE_ARG_DECL) activate (consumer_ref, poa.in (), this, - deactivator - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; + deactivator); // Obtain reference to ConsumerAdmin. RtecEventChannelAdmin::ConsumerAdmin_var consumer_admin = - this->ec_->for_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; + this->ec_->for_consumers (); // Obtain ProxyPushSupplier.. RtecEventChannelAdmin::ProxyPushSupplier_var proxy = - consumer_admin->obtain_push_supplier (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; + consumer_admin->obtain_push_supplier (); Supplier_Proxy_Disconnect new_proxy_disconnect (proxy.in ()); // Connect this consumer. @@ -367,9 +352,7 @@ Heartbeat_Application::connect_as_consumer (ACE_ENV_SINGLE_ARG_DECL) qos.start_disjunction_group (1); qos.insert_type (ACE_ES_EVENT_ANY, 0); proxy->connect_push_consumer (consumer_ref.in (), - qos.get_ConsumerQOS () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; + qos.get_ConsumerQOS ()); // Update resource managers. this->supplier_proxy_disconnect_.set_command (new_proxy_disconnect); @@ -380,7 +363,7 @@ int Heartbeat_Application::handle_timeout (const ACE_Time_Value&, const void*) { - ACE_TRY_NEW_ENV + try { if (this->n_timeouts_++ < HEARTBEATS_TO_SEND) { @@ -399,8 +382,7 @@ Heartbeat_Application::handle_timeout (const ACE_Time_Value&, (u_char *)this->hostname_and_pid_, 0); - this->consumer_->push (events ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + this->consumer_->push (events); } else // We already sent the required number of heartbeats. Time to @@ -409,19 +391,16 @@ Heartbeat_Application::handle_timeout (const ACE_Time_Value&, this->shutdown (); } } - ACE_CATCHANY + catch (const CORBA::Exception& ex) { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Suppressed the following exception in " - "Heartbeat_Application::handle_timeout:\n"); + ex._tao_print_exception ( + "Suppressed the following exception in ""Heartbeat_Application::handle_timeout:\n"); } - ACE_ENDTRY; return 0; } void -Heartbeat_Application::push (const RtecEventComm::EventSet &events - ACE_ENV_ARG_DECL_NOT_USED) +Heartbeat_Application::push (const RtecEventComm::EventSet &events) ACE_THROW_SPEC((CORBA::SystemException)) { for (CORBA::ULong i = 0; i < events.length (); ++i) @@ -467,7 +446,7 @@ Heartbeat_Application::push (const RtecEventComm::EventSet &events } void -Heartbeat_Application::disconnect_push_consumer (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +Heartbeat_Application::disconnect_push_consumer (void) ACE_THROW_SPEC((CORBA::SystemException)) { this->shutdown (); @@ -478,18 +457,15 @@ Heartbeat_Application::destroy_ec (void) { if (!CORBA::is_nil (this->ec_.in ())) { - ACE_TRY_NEW_ENV + try { - this->ec_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + this->ec_->destroy (); } - ACE_CATCHANY + catch (const CORBA::Exception& ex) { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Suppressed the following exception in " - "Application_Heartbeat::destroy_ec\n"); + ex._tao_print_exception ( + "Suppressed the following exception in ""Application_Heartbeat::destroy_ec\n"); } - ACE_ENDTRY; this->ec_ = RtecEventChannelAdmin::EventChannel::_nil (); } @@ -541,18 +517,15 @@ Heartbeat_Application::shutdown (void) } // Shutdown the ORB. - ACE_TRY_NEW_ENV + try { - this->orb_->shutdown (0 ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + this->orb_->shutdown (0); } - ACE_CATCHANY + catch (const CORBA::Exception& ex) { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "The following exception occured in " - "Heartbeat_Application::shutdown:\n"); + ex._tao_print_exception ( + "The following exception occured in ""Heartbeat_Application::shutdown:\n"); } - ACE_ENDTRY; } //////////////////////////////////////////////////////////// @@ -602,36 +575,29 @@ main (int argc, char *argv[]) // We may want this to be alive beyond the next block. TAO_EC_Servant_Var<Heartbeat_Application> app; - ACE_TRY_NEW_ENV + try { // Initialize ORB and POA, POA Manager, parse args. CORBA::ORB_var orb = - CORBA::ORB_init (argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + CORBA::ORB_init (argc, argv, ""); if (parse_args (argc, argv) == -1) return 1; CORBA::Object_var obj = - orb->resolve_initial_references ("RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + orb->resolve_initial_references ("RootPOA"); PortableServer::POA_var poa = - PortableServer::POA::_narrow (obj.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + PortableServer::POA::_narrow (obj.in ()); if (check_for_nil (poa.in (), "POA") == -1) return 1; PortableServer::POAManager_var manager = - poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + poa->the_POAManager (); // Obtain reference to EC. - obj = orb->resolve_initial_references ("Event_Service" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + obj = orb->resolve_initial_references ("Event_Service"); RtecEventChannelAdmin::EventChannel_var ec = - RtecEventChannelAdmin::EventChannel::_narrow (obj.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + RtecEventChannelAdmin::EventChannel::_narrow (obj.in ()); if (check_for_nil (ec.in (), "EC") == -1) return 1; @@ -640,27 +606,22 @@ main (int argc, char *argv[]) if (!app.in ()) return 1; - app->init (orb, ec ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + app->init (orb, ec); // Allow processing of CORBA requests. - manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + manager->activate (); // Receive events from EC. - orb->run (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + orb->run (); } - ACE_CATCHANY + catch (const CORBA::Exception& ex) { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Exception in Heartbeat Application:"); + ex._tao_print_exception ("Exception in Heartbeat Application:"); // Since there was an exception, application might not have had // a chance to shutdown. app->shutdown (); return 1; } - ACE_ENDTRY; return 0; } |