diff options
Diffstat (limited to 'TAO/examples/ior_corbaloc/server.cpp')
-rw-r--r-- | TAO/examples/ior_corbaloc/server.cpp | 46 |
1 files changed, 15 insertions, 31 deletions
diff --git a/TAO/examples/ior_corbaloc/server.cpp b/TAO/examples/ior_corbaloc/server.cpp index b5351d69be2..af4cf921000 100644 --- a/TAO/examples/ior_corbaloc/server.cpp +++ b/TAO/examples/ior_corbaloc/server.cpp @@ -7,15 +7,13 @@ int main (int argc, char* argv[]) { - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY + try { // First initialize the ORB, that will remove some arguments... CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "" /* the ORB name, it can be anything! */ - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + ); if (argc < 2) { @@ -24,22 +22,18 @@ int main (int argc, char* argv[]) } // Get a reference to the RootPOA CORBA::Object_var poa_object = - orb->resolve_initial_references ("RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + orb->resolve_initial_references ("RootPOA"); // narrow down to the correct reference PortableServer::POA_var poa = - PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + PortableServer::POA::_narrow (poa_object.in ()); // Set a POA Manager PortableServer::POAManager_var poa_manager = - poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + poa->the_POAManager (); // Activate the POA Manager - poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + poa_manager->activate (); // Create the servant corbaloc_Status_i status_i; @@ -47,18 +41,14 @@ int main (int argc, char* argv[]) // Activate it to obtain the reference corbaloc::Status_var status = status_i._this (); - ACE_TRY_CHECK; // Get a reference to Naming Context CORBA::Object_var naming_context_object = - orb->resolve_initial_references ("NameService" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + orb->resolve_initial_references ("NameService"); // Narrow down the reference CosNaming::NamingContext_var naming_context = - CosNaming::NamingContext::_narrow (naming_context_object.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + CosNaming::NamingContext::_narrow (naming_context_object.in ()); // Bind Iterator_Factory to the Naming Context CosNaming::Name name (1); @@ -66,26 +56,20 @@ int main (int argc, char* argv[]) name[0].id = CORBA::string_dup (argv[1]); naming_context->rebind (name, status.in ()); - ACE_TRY_CHECK; // Run the orb - orb->run (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + orb->run (); // Destroy the POA, waiting until the destruction terminates - poa->destroy (1, 1 ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + poa->destroy (1, 1); + orb->destroy (); } - ACE_CATCH (CORBA::SystemException, ex) { - ACE_PRINT_EXCEPTION (ex, "CORBA exception raised! "); + catch (const CORBA::SystemException& ex){ + ex._tao_print_exception ("CORBA exception raised! "); } - ACE_CATCHANY { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Exception caught in server"); + catch (const CORBA::Exception& ex){ + ex._tao_print_exception ("Exception caught in server"); } - ACE_ENDTRY; - ACE_CHECK_RETURN (-1); return 0; } |