diff options
Diffstat (limited to 'TAO/examples/CSD_Strategy/ThreadPool2')
9 files changed, 73 insertions, 102 deletions
diff --git a/TAO/examples/CSD_Strategy/ThreadPool2/ClientApp.cpp b/TAO/examples/CSD_Strategy/ThreadPool2/ClientApp.cpp index 14e52e52804..0472e80e6e6 100644 --- a/TAO/examples/CSD_Strategy/ThreadPool2/ClientApp.cpp +++ b/TAO/examples/CSD_Strategy/ThreadPool2/ClientApp.cpp @@ -18,9 +18,8 @@ ClientApp::~ClientApp() int ClientApp::run(int argc, char* argv[] ACE_ENV_ARG_DECL) { - CORBA::ORB_var orb + 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. @@ -32,9 +31,8 @@ ClientApp::run(int argc, char* argv[] ACE_ENV_ARG_DECL) return result; } - CORBA::Object_var obj + CORBA::Object_var obj = orb->string_to_object(this->ior_.c_str() ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); if (CORBA::is_nil(obj.in())) { @@ -44,7 +42,6 @@ ClientApp::run(int argc, char* argv[] ACE_ENV_ARG_DECL) } Foo_var foo = Foo::_narrow(obj.in() ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); if (CORBA::is_nil(foo.in())) { @@ -55,12 +52,9 @@ ClientApp::run(int argc, char* argv[] ACE_ENV_ARG_DECL) for (CORBA::Long i = 1; i <= 100; i++) { - foo->op1(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); + foo->op1(); foo->op2(i ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - CORBA::Long value = foo->op3(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); + CORBA::Long value = foo->op3(); ACE_DEBUG((LM_DEBUG, "(%P|%t) ===> Value retrieved from op3() == %d\n", @@ -69,19 +63,17 @@ ClientApp::run(int argc, char* argv[] ACE_ENV_ARG_DECL) for (CORBA::Long j = 1; j <= 5; j++) { foo->op4(495 + (i * 5) + j ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); } ACE_TRY_NEW_ENV { - foo->op5(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + foo->op5(); } ACE_CATCH (FooException, ex) { ACE_DEBUG((LM_DEBUG, "(%P|%t) ===> Caught FooException - as expected.\n")); - + } ACE_ENDTRY; } @@ -89,8 +81,7 @@ ClientApp::run(int argc, char* argv[] ACE_ENV_ARG_DECL) ACE_DEBUG((LM_DEBUG, "(%P|%t) ===> Tell server that we are done().\n")); - foo->done(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); + foo->done(); ACE_DEBUG((LM_DEBUG, "(%P|%t) ===> Back from done().\n")); @@ -104,7 +95,7 @@ int ClientApp::parse_args(int argc, char* argv[]) { this->exe_name_ = argv[0]; - + ACE_Get_Opt get_opts(argc, argv, "i:"); int c; diff --git a/TAO/examples/CSD_Strategy/ThreadPool2/FooServantList.cpp b/TAO/examples/CSD_Strategy/ThreadPool2/FooServantList.cpp index 1c1fc13eaf6..992ba37ed74 100644 --- a/TAO/examples/CSD_Strategy/ThreadPool2/FooServantList.cpp +++ b/TAO/examples/CSD_Strategy/ThreadPool2/FooServantList.cpp @@ -39,14 +39,12 @@ FooServantList::create_and_activate(PortableServer::POA_ptr poa PortableServer::ObjectId_var id = PortableServer::string_to_ObjectId(servant_name.c_str()); - poa->activate_object_with_id(id.in(), - this->servants_[i].in() + poa->activate_object_with_id(id.in(), + this->servants_[i].in() ACE_ENV_ARG_PARAMETER); - ACE_CHECK; CORBA::Object_var obj = poa->id_to_reference(id.in() ACE_ENV_ARG_PARAMETER); - ACE_CHECK; if (CORBA::is_nil(obj.in())) { @@ -56,10 +54,9 @@ FooServantList::create_and_activate(PortableServer::POA_ptr poa ACE_THROW (TestException()); } - CORBA::String_var ior - = this->orb_->object_to_string(obj.in() + CORBA::String_var ior + = this->orb_->object_to_string(obj.in() ACE_ENV_ARG_PARAMETER); - ACE_CHECK; ACE_CString filename = servant_name + ".ior"; FILE* ior_file = ACE_OS::fopen(filename.c_str(), "w"); @@ -79,7 +76,7 @@ FooServantList::create_and_activate(PortableServer::POA_ptr poa void -FooServantList::client_done(ACE_ENV_SINGLE_ARG_DECL) +FooServantList::client_done(void) { unsigned num_left; @@ -94,6 +91,6 @@ FooServantList::client_done(ACE_ENV_SINGLE_ARG_DECL) { ACE_ERROR((LM_ERROR, "(%P|%t)FooServantList::client_done: " "failed to create orb shutdown thread.\n")); - } + } } } diff --git a/TAO/examples/CSD_Strategy/ThreadPool2/FooServantList.h b/TAO/examples/CSD_Strategy/ThreadPool2/FooServantList.h index d6e35ff894a..3cc35490273 100644 --- a/TAO/examples/CSD_Strategy/ThreadPool2/FooServantList.h +++ b/TAO/examples/CSD_Strategy/ThreadPool2/FooServantList.h @@ -21,7 +21,7 @@ class FooServantList void create_and_activate(PortableServer::POA_ptr poa ACE_ENV_ARG_DECL); - void client_done(ACE_ENV_SINGLE_ARG_DECL); + void client_done(void); private: diff --git a/TAO/examples/CSD_Strategy/ThreadPool2/Foo_i.cpp b/TAO/examples/CSD_Strategy/ThreadPool2/Foo_i.cpp index 5923bb5b022..6d0e99c79e5 100644 --- a/TAO/examples/CSD_Strategy/ThreadPool2/Foo_i.cpp +++ b/TAO/examples/CSD_Strategy/ThreadPool2/Foo_i.cpp @@ -22,7 +22,7 @@ Foo_i::~Foo_i() void -Foo_i::op1(ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +Foo_i::op1(void) ACE_THROW_SPEC((CORBA::SystemException)) { ++this->count_op1_; @@ -32,7 +32,7 @@ Foo_i::op1(ACE_ENV_SINGLE_ARG_DECL_NOT_USED) void -Foo_i::op2(CORBA::Long value ACE_ENV_ARG_DECL_NOT_USED) +Foo_i::op2(CORBA::Long value ACE_ENV_ARG_DECL_NOT_USED) ACE_THROW_SPEC((CORBA::SystemException)) { ++this->count_op2_; @@ -41,7 +41,7 @@ Foo_i::op2(CORBA::Long value ACE_ENV_ARG_DECL_NOT_USED) CORBA::Long -Foo_i::op3(ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +Foo_i::op3(void) ACE_THROW_SPEC((CORBA::SystemException)) { ++this->count_op3_; @@ -50,7 +50,7 @@ Foo_i::op3(ACE_ENV_SINGLE_ARG_DECL_NOT_USED) void -Foo_i::op4(CORBA::Long value ACE_ENV_ARG_DECL_NOT_USED) +Foo_i::op4(CORBA::Long value ACE_ENV_ARG_DECL_NOT_USED) ACE_THROW_SPEC((CORBA::SystemException)) { ++this->count_op4_; @@ -69,7 +69,7 @@ Foo_i::op4(CORBA::Long value ACE_ENV_ARG_DECL_NOT_USED) void -Foo_i::op5(ACE_ENV_SINGLE_ARG_DECL) +Foo_i::op5(void) ACE_THROW_SPEC((CORBA::SystemException, FooException)) { ++this->count_op5_; @@ -78,9 +78,8 @@ Foo_i::op5(ACE_ENV_SINGLE_ARG_DECL) void -Foo_i::done(ACE_ENV_SINGLE_ARG_DECL) +Foo_i::done(void) ACE_THROW_SPEC((CORBA::SystemException)) { - this->mgr_->client_done(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; + this->mgr_->client_done(); } diff --git a/TAO/examples/CSD_Strategy/ThreadPool2/Foo_i.h b/TAO/examples/CSD_Strategy/ThreadPool2/Foo_i.h index d68b2bc84c1..b6e222ad663 100644 --- a/TAO/examples/CSD_Strategy/ThreadPool2/Foo_i.h +++ b/TAO/examples/CSD_Strategy/ThreadPool2/Foo_i.h @@ -16,22 +16,22 @@ class Foo_i : public virtual POA_Foo Foo_i(const char* servant_name, FooServantList* mgr); virtual ~Foo_i(); - virtual void op1(ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + virtual void op1(void) ACE_THROW_SPEC((CORBA::SystemException)); - virtual void op2(CORBA::Long value ACE_ENV_ARG_DECL_WITH_DEFAULTS) + virtual void op2(CORBA::Long value ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC((CORBA::SystemException)); - virtual CORBA::Long op3(ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + virtual CORBA::Long op3(void) ACE_THROW_SPEC((CORBA::SystemException)); - virtual void op4(CORBA::Long value ACE_ENV_ARG_DECL_WITH_DEFAULTS) + virtual void op4(CORBA::Long value ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC((CORBA::SystemException)); - virtual void op5(ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + virtual void op5(void) ACE_THROW_SPEC((CORBA::SystemException, FooException)); - virtual void done(ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + virtual void done(void) ACE_THROW_SPEC((CORBA::SystemException)); diff --git a/TAO/examples/CSD_Strategy/ThreadPool2/OrbShutdownTask.cpp b/TAO/examples/CSD_Strategy/ThreadPool2/OrbShutdownTask.cpp index f9d551e8aee..1fff7c4562b 100644 --- a/TAO/examples/CSD_Strategy/ThreadPool2/OrbShutdownTask.cpp +++ b/TAO/examples/CSD_Strategy/ThreadPool2/OrbShutdownTask.cpp @@ -25,7 +25,7 @@ OrbShutdownTask::~OrbShutdownTask() } -void +void OrbShutdownTask::orb(CORBA::ORB_ptr orb) { this->orb_ = CORBA::ORB::_duplicate (orb); @@ -56,7 +56,6 @@ OrbShutdownTask::svc() ACE_TRY_NEW_ENV { this->orb_->shutdown(0 ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; } ACE_CATCHALL { diff --git a/TAO/examples/CSD_Strategy/ThreadPool2/ServerApp.cpp b/TAO/examples/CSD_Strategy/ThreadPool2/ServerApp.cpp index 30670fa4ee3..d2c5ca64ccd 100644 --- a/TAO/examples/CSD_Strategy/ThreadPool2/ServerApp.cpp +++ b/TAO/examples/CSD_Strategy/ThreadPool2/ServerApp.cpp @@ -28,7 +28,6 @@ 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. @@ -42,9 +41,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())) { @@ -53,9 +51,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())) { @@ -64,24 +61,21 @@ ServerApp::run(int argc, char* argv[] ACE_ENV_ARG_DECL) ACE_THROW_RETURN (TestException(), -1); } - PortableServer::POAManager_var poa_manager - = root_poa->the_POAManager(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); + PortableServer::POAManager_var poa_manager + = root_poa->the_POAManager(); // Create the child POA. CORBA::PolicyList policies(1); policies.length(1); - policies[0] = root_poa->create_id_assignment_policy(PortableServer::USER_ID + policies[0] = root_poa->create_id_assignment_policy(PortableServer::USER_ID ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - PortableServer::POA_var child_poa + PortableServer::POA_var child_poa = root_poa->create_POA("ChildPoa", poa_manager.in(), policies ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); if (CORBA::is_nil(child_poa.in())) { @@ -90,8 +84,7 @@ ServerApp::run(int argc, char* argv[] ACE_ENV_ARG_DECL) ACE_THROW_RETURN (TestException(), -1); } - policies[0]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); + policies[0]->destroy (); // Create the thread pool servant dispatching strategy object, and // hold it in a (local) smart pointer variable. @@ -107,7 +100,6 @@ 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); FooServantList servants(this->ior_filename_.c_str(), this->num_servants_, @@ -115,18 +107,15 @@ ServerApp::run(int argc, char* argv[] ACE_ENV_ARG_DECL) orb.in()); servants.create_and_activate(child_poa.in() ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); // 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. " @@ -145,13 +134,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); + orb->destroy(); ACE_DEBUG((LM_DEBUG, "(%P|%t) ServerApp has completed running successfully.\n")); diff --git a/TAO/examples/CSD_Strategy/ThreadPool2/client_main.cpp b/TAO/examples/CSD_Strategy/ThreadPool2/client_main.cpp index 545d6b52a9a..c9111a31dad 100644 --- a/TAO/examples/CSD_Strategy/ThreadPool2/client_main.cpp +++ b/TAO/examples/CSD_Strategy/ThreadPool2/client_main.cpp @@ -21,24 +21,23 @@ main(int argc, char* argv[]) ClientApp app; - ACE_TRY_NEW_ENV - { - int ret = app.run(argc,argv ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - return ret == 1 ? 0 : ret; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Caught exception:"); - } - ACE_CATCHALL - { - ACE_ERROR((LM_ERROR, - "(%P|%t) Unknown (...) exception caught in main() " - "for ClientApp\n")); - } - ACE_ENDTRY; + ACE_TRY_NEW_ENV + { + int ret = app.run(argc,argv ACE_ENV_ARG_PARAMETER); + return ret == 1 ? 0 : ret; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Caught exception:"); + } + ACE_CATCHALL + { + ACE_ERROR((LM_ERROR, + "(%P|%t) Unknown (...) exception caught in main() " + "for ClientApp\n")); + } + ACE_ENDTRY; return 1; } diff --git a/TAO/examples/CSD_Strategy/ThreadPool2/server_main.cpp b/TAO/examples/CSD_Strategy/ThreadPool2/server_main.cpp index bb14220d3c7..b4c517cc01a 100644 --- a/TAO/examples/CSD_Strategy/ThreadPool2/server_main.cpp +++ b/TAO/examples/CSD_Strategy/ThreadPool2/server_main.cpp @@ -21,24 +21,23 @@ main(int argc, char* argv[]) ServerApp app; - ACE_TRY_NEW_ENV - { - int ret = app.run(argc,argv ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - return ret == 1 ? 0 : ret; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - "Caught exception:"); - } - ACE_CATCHALL - { - ACE_ERROR((LM_ERROR, - "(%P|%t) Unknown (...) exception caught in main() " - "for ServerApp\n")); - } - ACE_ENDTRY; + ACE_TRY_NEW_ENV + { + int ret = app.run(argc,argv ACE_ENV_ARG_PARAMETER); + return ret == 1 ? 0 : ret; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Caught exception:"); + } + ACE_CATCHALL + { + ACE_ERROR((LM_ERROR, + "(%P|%t) Unknown (...) exception caught in main() " + "for ServerApp\n")); + } + ACE_ENDTRY; return 1; } |