diff options
Diffstat (limited to 'TAO/examples/CSD_Strategy/ThreadPool/ServerApp.cpp')
-rw-r--r-- | TAO/examples/CSD_Strategy/ThreadPool/ServerApp.cpp | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/TAO/examples/CSD_Strategy/ThreadPool/ServerApp.cpp b/TAO/examples/CSD_Strategy/ThreadPool/ServerApp.cpp index 8a107eff964..9deea393be0 100644 --- a/TAO/examples/CSD_Strategy/ThreadPool/ServerApp.cpp +++ b/TAO/examples/CSD_Strategy/ThreadPool/ServerApp.cpp @@ -25,13 +25,12 @@ int ServerApp::run(int argc, char* argv[] ACE_ENV_ARG_DECL) { CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); // Parse the command-line args for this application. // * Raises -1 if problems are encountered. // * Returns 1 if the usage statement was explicitly requested. // * Returns 0 otherwise. - int result = this->parse_args(argc, argv); + int result = this->parse_args(argc, argv); if (result != 0) { return result; @@ -39,9 +38,8 @@ ServerApp::run(int argc, char* argv[] ACE_ENV_ARG_DECL) TheOrbShutdownTask::instance()->orb (orb.in ()); - CORBA::Object_var obj + CORBA::Object_var obj = orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); if (CORBA::is_nil(obj.in())) { @@ -50,9 +48,8 @@ ServerApp::run(int argc, char* argv[] ACE_ENV_ARG_DECL) ACE_THROW_RETURN (TestException(), -1); } - PortableServer::POA_var root_poa + PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj.in() ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); if (CORBA::is_nil(root_poa.in())) { @@ -61,20 +58,18 @@ ServerApp::run(int argc, char* argv[] ACE_ENV_ARG_DECL) ACE_THROW_RETURN (TestException(), -1); } - PortableServer::POAManager_var poa_manager + PortableServer::POAManager_var poa_manager = root_poa->the_POAManager( ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); // Create the child POA. CORBA::PolicyList policies(0); policies.length(0); - PortableServer::POA_var child_poa + PortableServer::POA_var child_poa = root_poa->create_POA("ChildPoa", poa_manager.in(), - policies + policies ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); if (CORBA::is_nil(child_poa.in())) { @@ -95,24 +90,21 @@ ServerApp::run(int argc, char* argv[] ACE_ENV_ARG_DECL) "Failed to apply custom dispatching strategy to child poa.\n")); ACE_THROW_RETURN (TestException(), -1); } - ACE_CHECK_RETURN (-1); // Create the servant object. Foo_i* servant = new Foo_i(this->num_clients_); - + // local smart pointer variable to deal with releasing the reference // to the servant object when the smart pointer object falls out of scope. PortableServer::ServantBase_var owner_transfer(servant); // Activate the servant using the Child POA. - PortableServer::ObjectId_var oid - = child_poa->activate_object(servant + PortableServer::ObjectId_var oid + = child_poa->activate_object(servant ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); // Obtain the object reference. obj = child_poa->servant_to_reference(servant ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); if (CORBA::is_nil(obj.in())) { @@ -122,9 +114,8 @@ ServerApp::run(int argc, char* argv[] ACE_ENV_ARG_DECL) } // Stringify the object reference - CORBA::String_var ior + CORBA::String_var ior = orb->object_to_string(obj.in() ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); // Write the stringified object reference to the ior file. FILE* ior_file = ACE_OS::fopen(this->ior_filename_.c_str(), "w"); @@ -141,15 +132,13 @@ ServerApp::run(int argc, char* argv[] ACE_ENV_ARG_DECL) ACE_OS::fclose(ior_file); // Activate the POA Manager - poa_manager->activate(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); + poa_manager->activate(); ACE_DEBUG((LM_DEBUG, "(%P|%t) ServerApp is ready. Running the ORB event loop.\n")); // Run the ORB event loop. - orb->run(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); + orb->run(); ACE_DEBUG((LM_DEBUG, "(%P|%t) ServerApp ORB has stopped running. " @@ -168,13 +157,11 @@ ServerApp::run(int argc, char* argv[] ACE_ENV_ARG_DECL) // Tear-down the root poa and orb. root_poa->destroy(1, 1 ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); ACE_DEBUG((LM_DEBUG, "(%P|%t) ServerApp is destroying the ORB.\n")); orb->destroy( ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); ACE_DEBUG((LM_DEBUG, "(%P|%t) ServerApp has completed running successfully.\n")); |