diff options
Diffstat (limited to 'TAO/examples/POA/Loader/Server_Manager.cpp')
-rw-r--r-- | TAO/examples/POA/Loader/Server_Manager.cpp | 143 |
1 files changed, 67 insertions, 76 deletions
diff --git a/TAO/examples/POA/Loader/Server_Manager.cpp b/TAO/examples/POA/Loader/Server_Manager.cpp index 2fb1ee10d7f..16bf3ee6fee 100644 --- a/TAO/examples/POA/Loader/Server_Manager.cpp +++ b/TAO/examples/POA/Loader/Server_Manager.cpp @@ -1,7 +1,6 @@ // $Id$ #include "Server_Manager.h" -#include "ace/Get_Opt.h" ACE_RCSID(Loader, Server_Manager, "$Id$") @@ -108,16 +107,16 @@ Server_i::write_iors_to_file (const char *first_ior, int Server_i::init (int argc, char **argv) { - //CORBA::Environment TAO_TRY_ENV; - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY + CORBA::Environment TAO_TRY_ENV; + + TAO_TRY { // Initialize the ORB. orb_ = CORBA::ORB_init (argc, argv, 0, - ACE_TRY_ENV); - ACE_TRY_CHECK; + TAO_TRY_ENV); + TAO_CHECK_ENV; int result = parse_args (argc, argv); if (result != 0) @@ -129,20 +128,20 @@ Server_i::init (int argc, char **argv) // Narrow the Object reference to a POA reference root_poa_ = PortableServer::POA::_narrow (obj.in (), - ACE_TRY_ENV); - ACE_TRY_CHECK; + TAO_TRY_ENV); + TAO_CHECK_ENV; // Get the POAManager of RootPOA - poa_manager_ = root_poa_->the_POAManager (ACE_TRY_ENV); - ACE_TRY_CHECK; + poa_manager_ = root_poa_->the_POAManager (TAO_TRY_ENV); + TAO_CHECK_ENV; } - ACE_CATCHANY + TAO_CATCHANY { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Server_i:init_poa ()"); + TAO_TRY_ENV.print_exception ("Server_i:init_poa ()"); return 1; } - ACE_ENDTRY; + TAO_ENDTRY; return 0; } @@ -155,12 +154,10 @@ PortableServer::POA_ptr Server_i::create_poa (const char *name, int servant_retention_policy) { - // CORBA::Environment TAO_TRY_ENV; + CORBA::Environment TAO_TRY_ENV; PortableServer::POA_ptr my_poa = 0; - - ACE_DECLARE_NEW_CORBA_ENV; - - ACE_TRY + + TAO_TRY { policies_.length (4); @@ -168,36 +165,36 @@ Server_i::create_poa (const char *name, policies_[0] = root_poa_->create_id_assignment_policy (PortableServer::USER_ID, - ACE_TRY_ENV); - ACE_TRY_CHECK; + TAO_TRY_ENV); + TAO_CHECK_ENV; // Lifespan Policy. policies_[1] = root_poa_->create_lifespan_policy (PortableServer::PERSISTENT, - ACE_TRY_ENV); - ACE_TRY_CHECK; + TAO_TRY_ENV); + TAO_CHECK_ENV; // Request Processing Policy. policies_[2] = root_poa_->create_request_processing_policy (PortableServer::USE_SERVANT_MANAGER, - ACE_TRY_ENV); - ACE_TRY_CHECK; + TAO_TRY_ENV); + TAO_CHECK_ENV; // Servant Retention Policy. if (servant_retention_policy == 1) policies_[3] = root_poa_->create_servant_retention_policy (PortableServer::RETAIN, - ACE_TRY_ENV); + TAO_TRY_ENV); if (servant_retention_policy == 0) policies_[3] = root_poa_->create_servant_retention_policy (PortableServer::NON_RETAIN, - ACE_TRY_ENV); - ACE_TRY_CHECK; + TAO_TRY_ENV); + TAO_CHECK_ENV; // Create myPOA as the child of RootPOA with the above // policies_. myPOA will use SERVANT_ACTIVATOR or @@ -206,26 +203,25 @@ Server_i::create_poa (const char *name, my_poa = root_poa_->create_POA (name, poa_manager_.in (), policies_, - ACE_TRY_ENV); - ACE_TRY_CHECK; + TAO_TRY_ENV); + TAO_CHECK_ENV; // Destroy the policy objects as they have been passed to // create_POA and no longer needed. for (CORBA::ULong i = 0; - i < policies_.length () && ACE_TRY_ENV.exception () == 0; + i < policies_.length () && TAO_TRY_ENV.exception () == 0; ++i) { CORBA::Policy_ptr policy = policies_[i]; - policy->destroy (ACE_TRY_ENV); + policy->destroy (TAO_TRY_ENV); } } - ACE_CATCHANY + TAO_CATCHANY { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,"Server_i:create_poa ()"); + TAO_TRY_ENV.print_exception ("Server_i:create_poa ()"); return 0; } - ACE_ENDTRY; - ACE_CHECK_RETURN (0); + TAO_ENDTRY; return my_poa; } @@ -235,11 +231,9 @@ Server_i::create_poa (const char *name, int Server_i::create_activator (PortableServer::POA_var first_poa) { - // CORBA::Environment TAO_TRY_ENV; + CORBA::Environment TAO_TRY_ENV; - ACE_DECLARE_NEW_CORBA_ENV; - - ACE_TRY + TAO_TRY { // An Servant Activator object is created which will activate // the servant on demand. @@ -251,14 +245,14 @@ Server_i::create_activator (PortableServer::POA_var first_poa) 0); PortableServer::ServantActivator_var servant_activator = - servant_activator_impl_->_this (ACE_TRY_ENV); - ACE_TRY_CHECK; + servant_activator_impl_->_this (TAO_TRY_ENV); + TAO_CHECK_ENV; // Set ServantActivator_i object as the servant_manager of // firstPOA. first_poa->set_servant_manager (servant_activator.in (), - ACE_TRY_ENV); - ACE_TRY_CHECK; + TAO_TRY_ENV); + TAO_CHECK_ENV; // Create a reference with user created ID in firstPOA which // uses the MyFooServantActivator. @@ -267,15 +261,15 @@ Server_i::create_activator (PortableServer::POA_var first_poa) first_foo_ = first_poa->create_reference_with_id (first_foo_oid.in (), "IDL:Foo:1.0", - ACE_TRY_ENV); - ACE_TRY_CHECK; + TAO_TRY_ENV); + TAO_CHECK_ENV; } - ACE_CATCHANY + TAO_CATCHANY { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,"Server_i:create_activator ()"); + TAO_TRY_ENV.print_exception ("Server_i:create_activator ()"); return 1; } - ACE_ENDTRY; + TAO_ENDTRY; return 0; } @@ -285,10 +279,9 @@ Server_i::create_activator (PortableServer::POA_var first_poa) int Server_i::create_locator (PortableServer::POA_var second_poa) { - // CORBA::Environment TAO_TRY_ENV; - ACE_DECLARE_NEW_CORBA_ENV; - - ACE_TRY + CORBA::Environment TAO_TRY_ENV; + + TAO_TRY { // An Servant Locator object is created which will activate // the servant on demand. @@ -300,15 +293,15 @@ Server_i::create_locator (PortableServer::POA_var second_poa) 0); PortableServer::ServantLocator_var servant_locator = - servant_locator_impl_->_this (ACE_TRY_ENV); - ACE_TRY_CHECK; + servant_locator_impl_->_this (TAO_TRY_ENV); + TAO_CHECK_ENV; // Set ServantLocator_i object as the servant Manager of // secondPOA. second_poa->set_servant_manager (servant_locator.in (), - ACE_TRY_ENV); - ACE_TRY_CHECK; + TAO_TRY_ENV); + TAO_CHECK_ENV; // Try to create a reference with user created ID in second_poa // which uses MyFooServantLocator. @@ -318,15 +311,15 @@ Server_i::create_locator (PortableServer::POA_var second_poa) second_foo_ = second_poa->create_reference_with_id (second_foo_oid.in (), "IDL:Foo:1.0", - ACE_TRY_ENV); - ACE_TRY_CHECK; + TAO_TRY_ENV); + TAO_CHECK_ENV; } - ACE_CATCHANY + TAO_CATCHANY { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,"Server_i:create_locator ()"); + TAO_TRY_ENV.print_exception ("Server_i:create_locator ()"); return 1; } - ACE_ENDTRY; + TAO_ENDTRY; return 0; } @@ -336,24 +329,22 @@ Server_i::create_locator (PortableServer::POA_var second_poa) int Server_i::run (void) { - // CORBA::Environment TAO_TRY_ENV; + CORBA::Environment TAO_TRY_ENV; - ACE_DECLARE_NEW_CORBA_ENV; - - ACE_TRY + TAO_TRY { // Invoke object_to_string on the references created in firstPOA // and secondPOA. CORBA::String_var first_foo_ior = orb_->object_to_string (first_foo_.in (), - ACE_TRY_ENV); - ACE_TRY_CHECK; + TAO_TRY_ENV); + TAO_CHECK_ENV; CORBA::String_var second_foo_ior = orb_->object_to_string (second_foo_.in (), - ACE_TRY_ENV); - ACE_TRY_CHECK; + TAO_TRY_ENV); + TAO_CHECK_ENV; // Print the ior's of first_foo and second_foo. @@ -369,9 +360,9 @@ Server_i::run (void) // Set the poa_manager state to active, ready to process // requests. - poa_manager_->activate (ACE_TRY_ENV); + poa_manager_->activate (TAO_TRY_ENV); - ACE_TRY_CHECK; + TAO_CHECK_ENV; // Run the ORB. if (orb_->run () == -1) @@ -383,15 +374,15 @@ Server_i::run (void) // Destroy the root_poa_ and also first_poa and second_poa. root_poa_->destroy (1, 1, - ACE_TRY_ENV); - ACE_TRY_CHECK; + TAO_TRY_ENV); + TAO_CHECK_ENV; } - ACE_CATCHANY + TAO_CATCHANY { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,"Server_i:run ()"); + TAO_TRY_ENV.print_exception ("Server_i:run ()"); return 1; } - ACE_ENDTRY; + TAO_ENDTRY; return 0; } |