diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2007-01-24 15:39:09 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2007-01-24 15:39:09 +0000 |
commit | c801f87e59c00f72bdeb5ce7bd0d276674665bac (patch) | |
tree | 70bff03d1cf156ecf05ee4c5c338d8ce423e64ee /TAO/tests/CSD_Strategy_Tests/TP_Test_3 | |
parent | 98c0b37d4714ff774fc3ada8c9ee893c719af714 (diff) | |
download | ATCD-c801f87e59c00f72bdeb5ce7bd0d276674665bac.tar.gz |
Wed Jan 24 14:00:12 UTC 2007 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'TAO/tests/CSD_Strategy_Tests/TP_Test_3')
-rw-r--r-- | TAO/tests/CSD_Strategy_Tests/TP_Test_3/ClientApp.cpp | 70 | ||||
-rw-r--r-- | TAO/tests/CSD_Strategy_Tests/TP_Test_3/ClientApp.h | 10 | ||||
-rw-r--r-- | TAO/tests/CSD_Strategy_Tests/TP_Test_3/ServerApp.cpp | 100 | ||||
-rw-r--r-- | TAO/tests/CSD_Strategy_Tests/TP_Test_3/ServerApp.h | 14 |
4 files changed, 77 insertions, 117 deletions
diff --git a/TAO/tests/CSD_Strategy_Tests/TP_Test_3/ClientApp.cpp b/TAO/tests/CSD_Strategy_Tests/TP_Test_3/ClientApp.cpp index 147b5ca43cf..c07d9defed6 100644 --- a/TAO/tests/CSD_Strategy_Tests/TP_Test_3/ClientApp.cpp +++ b/TAO/tests/CSD_Strategy_Tests/TP_Test_3/ClientApp.cpp @@ -32,23 +32,17 @@ int ClientApp::run_i(int argc, char* argv[] ACE_ENV_ARG_DECL) { int result = this->init(argc, argv ACE_ENV_ARG_PARAMETER); - if (result != 0) + if (result != 0) { return result; } - ACE_CHECK_RETURN (-1); - - this->poa_setup(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - this->csd_setup(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - this->client_setup(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - this->poa_activate(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); + + this->poa_setup(); + this->csd_setup(); + this->client_setup(); + this->poa_activate(); this->run_clients(); - this->run_orb_event_loop(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); + this->run_orb_event_loop(); // Calling wait on ACE_Thread_Manager singleton to avoid the problem // that the main thread might exit before all CSD Threads exit. @@ -67,7 +61,6 @@ int ClientApp::init(int argc, char* argv[] ACE_ENV_ARG_DECL) { this->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. @@ -80,24 +73,22 @@ ClientApp::init(int argc, char* argv[] ACE_ENV_ARG_DECL) } TheAppShutdown->init(this->orb_.in(), num_servants_ ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); return 0; } void -ClientApp::poa_setup(ACE_ENV_SINGLE_ARG_DECL) +ClientApp::poa_setup(void) { - this->poa_ = this->create_poa(this->orb_.in(), - "ChildPoa" + this->poa_ = this->create_poa(this->orb_.in(), + "ChildPoa" ACE_ENV_ARG_PARAMETER); - ACE_CHECK; } void -ClientApp::csd_setup(ACE_ENV_SINGLE_ARG_DECL) +ClientApp::csd_setup(void) { this->tp_strategy_ = new TAO::CSD::TP_Strategy(this->num_csd_threads_); @@ -107,41 +98,36 @@ ClientApp::csd_setup(ACE_ENV_SINGLE_ARG_DECL) "Failed to apply CSD strategy to poa.\n")); ACE_THROW(TestAppException()); } - ACE_CHECK; } void -ClientApp::client_setup(ACE_ENV_SINGLE_ARG_DECL) +ClientApp::client_setup(void) { // Turn the ior_ into a Foo_B obj ref. Foo_B_var foo = RefHelper<Foo_B>::string_to_ref(this->orb_.in(), this->ior_.c_str() ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - + this->servants_.create_and_activate(1, // number of callback servants this->poa_.in() ACE_ENV_ARG_PARAMETER); - ACE_CHECK; ServantListType::T_stub_var cb = this->servants_.objref(0); - // Create the ClientEngine object, and give it the Foo_B and Callback object + // Create the ClientEngine object, and give it the Foo_B and Callback object // references. - ClientEngine_Handle engine + ClientEngine_Handle engine = new Foo_B_ClientEngine(foo.in(), cb.in (), this->client_id_); this->client_task_.add_engine(engine.in()); } void -ClientApp::poa_activate(ACE_ENV_SINGLE_ARG_DECL) +ClientApp::poa_activate(void) { - PortableServer::POAManager_var poa_manager - = this->poa_->the_POAManager(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - poa_manager->activate(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; + PortableServer::POAManager_var poa_manager + = this->poa_->the_POAManager(); + poa_manager->activate(); } @@ -153,31 +139,28 @@ ClientApp::run_clients() void -ClientApp::run_orb_event_loop(ACE_ENV_SINGLE_ARG_DECL) +ClientApp::run_orb_event_loop(void) { OrbRunner orb_runner(this->orb_.in(), this->num_orb_threads_); - orb_runner.run(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; + orb_runner.run(); TheAppShutdown->wait (); } PortableServer::POA_ptr -ClientApp::create_poa(CORBA::ORB_ptr orb, - const char* poa_name +ClientApp::create_poa(CORBA::ORB_ptr orb, + const char* poa_name ACE_ENV_ARG_DECL) { // Get the Root POA. PortableServer::POA_var root_poa - = RefHelper<PortableServer::POA>::resolve_initial_ref(orb, + = RefHelper<PortableServer::POA>::resolve_initial_ref(orb, "RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (PortableServer::POA::_nil ()); // Get the POAManager from the Root POA. - PortableServer::POAManager_var poa_manager - = root_poa->the_POAManager(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (PortableServer::POA::_nil ()); + PortableServer::POAManager_var poa_manager + = root_poa->the_POAManager(); // Create the child POA Policies. CORBA::PolicyList policies(0); @@ -189,7 +172,6 @@ ClientApp::create_poa(CORBA::ORB_ptr orb, poa_manager.in(), policies ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (PortableServer::POA::_nil ()); // Give away the child POA_ptr from the POA_var variable. return poa._retn(); diff --git a/TAO/tests/CSD_Strategy_Tests/TP_Test_3/ClientApp.h b/TAO/tests/CSD_Strategy_Tests/TP_Test_3/ClientApp.h index 2eb6f23bd39..417447aee99 100644 --- a/TAO/tests/CSD_Strategy_Tests/TP_Test_3/ClientApp.h +++ b/TAO/tests/CSD_Strategy_Tests/TP_Test_3/ClientApp.h @@ -28,12 +28,12 @@ class ClientApp : public TestAppBase // These are all called, in order, by the run_i() method. int init(int argc, char* argv[] ACE_ENV_ARG_DECL); - void poa_setup(ACE_ENV_SINGLE_ARG_DECL); - void csd_setup(ACE_ENV_SINGLE_ARG_DECL); - void client_setup(ACE_ENV_SINGLE_ARG_DECL); - void poa_activate(ACE_ENV_SINGLE_ARG_DECL); + void poa_setup(void); + void csd_setup(void); + void client_setup(void); + void poa_activate(void); void run_clients(); - void run_orb_event_loop(ACE_ENV_SINGLE_ARG_DECL); + void run_orb_event_loop(void); bool check_validity (); void cleanup(); diff --git a/TAO/tests/CSD_Strategy_Tests/TP_Test_3/ServerApp.cpp b/TAO/tests/CSD_Strategy_Tests/TP_Test_3/ServerApp.cpp index 883a0dec322..e00db2de579 100644 --- a/TAO/tests/CSD_Strategy_Tests/TP_Test_3/ServerApp.cpp +++ b/TAO/tests/CSD_Strategy_Tests/TP_Test_3/ServerApp.cpp @@ -35,30 +35,22 @@ int ServerApp::run_i(int argc, char* argv[] ACE_ENV_ARG_DECL) { int result = this->init(argc, argv ACE_ENV_ARG_PARAMETER); - if (result != 0) + if (result != 0) { return result; } - ACE_CHECK_RETURN (-1); - - this->poa_setup(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - this->csd_setup(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - this->servant_setup(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - this->collocated_setup(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - this->poa_activate(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - this->run_collocated_clients(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); + + this->poa_setup(); + this->csd_setup(); + this->servant_setup(); + this->collocated_setup(); + this->poa_activate(); + this->run_collocated_clients(); ACE_DEBUG((LM_DEBUG, "(%P|%t) ServerApp is ready. Running the ORB event loop.\n")); - this->run_orb_event_loop(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); + this->run_orb_event_loop(); ACE_DEBUG((LM_DEBUG, "(%P|%t) ServerApp ORB event loop has completed.\n")); @@ -83,7 +75,6 @@ int ServerApp::init(int argc, char* argv[] ACE_ENV_ARG_DECL) { this->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. @@ -99,31 +90,28 @@ ServerApp::init(int argc, char* argv[] ACE_ENV_ARG_DECL) this->num_collocated_clients_; TheAppShutdown->init(this->orb_.in(), num_clients ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); return 0; } void -ServerApp::poa_setup(ACE_ENV_SINGLE_ARG_DECL) +ServerApp::poa_setup(void) { - this->poa_ = this->create_poa(this->orb_.in(), - "ChildPoa" + this->poa_ = this->create_poa(this->orb_.in(), + "ChildPoa" ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - + if (this->num_collocated_clients_ > 0) { - this->cb_poa_ = this->create_poa(this->orb_.in(), - "CallbackPoa" + this->cb_poa_ = this->create_poa(this->orb_.in(), + "CallbackPoa" ACE_ENV_ARG_PARAMETER); - ACE_CHECK; } } void -ServerApp::csd_setup(ACE_ENV_SINGLE_ARG_DECL) +ServerApp::csd_setup(void) { this->tp_strategy_ = new TAO::CSD::TP_Strategy(this->num_csd_threads_); @@ -133,10 +121,9 @@ ServerApp::csd_setup(ACE_ENV_SINGLE_ARG_DECL) "Failed to apply CSD strategy to poa.\n")); ACE_THROW(TestAppException()); } - ACE_CHECK; // Use another poa and strategy for callbacks. This would resolve - // the deadlock situation that happens when having number of csd + // the deadlock situation that happens when having number of csd // threads less than number of collocated clients. if (this->num_collocated_clients_ > 0) { @@ -146,26 +133,24 @@ ServerApp::csd_setup(ACE_ENV_SINGLE_ARG_DECL) ACE_ERROR((LM_ERROR, "Failed to apply CSD strategy to callback poa.\n")); ACE_THROW(TestAppException()); - } - ACE_CHECK; + } } } void -ServerApp::servant_setup(ACE_ENV_SINGLE_ARG_DECL) +ServerApp::servant_setup(void) { this->foo_servants_.create_and_activate(this->num_servants_, this->orb_.in (), this->poa_.in (), this->ior_filename_prefix_.c_str() ACE_ENV_ARG_PARAMETER); - ACE_CHECK; } void -ServerApp::collocated_setup(ACE_ENV_SINGLE_ARG_DECL) +ServerApp::collocated_setup(void) { if (this->num_collocated_clients_ == 0) return; @@ -173,10 +158,9 @@ ServerApp::collocated_setup(ACE_ENV_SINGLE_ARG_DECL) this->cb_servants_.create_and_activate(1, // number of callback servants this->cb_poa_.in() ACE_ENV_ARG_PARAMETER); - ACE_CHECK; CallbackServantListType::T_stub_var cb = this->cb_servants_.objref(0); - + unsigned client_id = this->num_remote_clients_; for (unsigned i = 0; i < this->num_collocated_clients_; i++) @@ -185,9 +169,9 @@ ServerApp::collocated_setup(ACE_ENV_SINGLE_ARG_DECL) // Dole out the servant object references in a round-robin fashion. unsigned servant_index = i % this->num_servants_; - FooServantListType::T_stub_var foo + FooServantListType::T_stub_var foo = this->foo_servants_.objref(servant_index); - ClientEngine_Handle engine + ClientEngine_Handle engine = new Foo_B_ClientEngine(foo.in(), cb.in (), client_id, true); this->collocated_client_task_.add_engine(engine.in()); } @@ -195,18 +179,16 @@ ServerApp::collocated_setup(ACE_ENV_SINGLE_ARG_DECL) void -ServerApp::poa_activate(ACE_ENV_SINGLE_ARG_DECL) +ServerApp::poa_activate(void) { - PortableServer::POAManager_var poa_manager - = this->poa_->the_POAManager(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - poa_manager->activate(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; + PortableServer::POAManager_var poa_manager + = this->poa_->the_POAManager(); + poa_manager->activate(); } void -ServerApp::run_collocated_clients(ACE_ENV_SINGLE_ARG_DECL) +ServerApp::run_collocated_clients(void) { if (this->num_collocated_clients_ > 0) { @@ -219,11 +201,10 @@ ServerApp::run_collocated_clients(ACE_ENV_SINGLE_ARG_DECL) void -ServerApp::run_orb_event_loop(ACE_ENV_SINGLE_ARG_DECL) +ServerApp::run_orb_event_loop(void) { OrbRunner orb_runner(this->orb_.in(), this->num_orb_threads_); - orb_runner.run(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; + orb_runner.run(); TheAppShutdown->wait (); } @@ -336,7 +317,7 @@ ServerApp::usage_statement() int ServerApp::arg_dependency_checks() { - return (this->num_remote_clients_ + return (this->num_remote_clients_ + this->num_collocated_clients_) > 0 ? 0 : -1; } @@ -365,21 +346,19 @@ ServerApp::set_arg(unsigned& value, PortableServer::POA_ptr -ServerApp::create_poa(CORBA::ORB_ptr orb, - const char* poa_name +ServerApp::create_poa(CORBA::ORB_ptr orb, + const char* poa_name ACE_ENV_ARG_DECL) { // Get the Root POA. PortableServer::POA_var root_poa - = RefHelper<PortableServer::POA>::resolve_initial_ref(orb, - "RootPOA" + = RefHelper<PortableServer::POA>::resolve_initial_ref(orb, + "RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (PortableServer::POA::_nil ()); // Get the POAManager from the Root POA. - PortableServer::POAManager_var poa_manager - = root_poa->the_POAManager(ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (PortableServer::POA::_nil ()); + PortableServer::POAManager_var poa_manager + = root_poa->the_POAManager(); // Create the child POA Policies. CORBA::PolicyList policies(0); @@ -391,7 +370,6 @@ ServerApp::create_poa(CORBA::ORB_ptr orb, poa_manager.in(), policies ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (PortableServer::POA::_nil ()); // Give away the child POA_ptr from the POA_var variable. return poa._retn(); @@ -402,7 +380,7 @@ bool ServerApp::check_validity () { // Check whether the clients return any errors. - if (this->num_collocated_clients_ > 0 + if (this->num_collocated_clients_ > 0 && this->collocated_client_task_.failure_count () > 0) { return false; @@ -410,7 +388,7 @@ ServerApp::check_validity () Foo_B_Statistics stats (this->num_remote_clients_, this->num_collocated_clients_); - + Foo_B_ClientEngine::expected_results (stats); for (unsigned i = 0; i < this->num_servants_; i++) diff --git a/TAO/tests/CSD_Strategy_Tests/TP_Test_3/ServerApp.h b/TAO/tests/CSD_Strategy_Tests/TP_Test_3/ServerApp.h index 12af1ec455b..20216f8fd52 100644 --- a/TAO/tests/CSD_Strategy_Tests/TP_Test_3/ServerApp.h +++ b/TAO/tests/CSD_Strategy_Tests/TP_Test_3/ServerApp.h @@ -28,13 +28,13 @@ class ServerApp : public TestAppBase // These are all called, in order, by the run_i() method. int init(int argc, char* argv[] ACE_ENV_ARG_DECL); - void poa_setup(ACE_ENV_SINGLE_ARG_DECL); - void csd_setup(ACE_ENV_SINGLE_ARG_DECL); - void servant_setup(ACE_ENV_SINGLE_ARG_DECL); - void collocated_setup(ACE_ENV_SINGLE_ARG_DECL); - void poa_activate(ACE_ENV_SINGLE_ARG_DECL); - void run_collocated_clients(ACE_ENV_SINGLE_ARG_DECL); - void run_orb_event_loop(ACE_ENV_SINGLE_ARG_DECL); + void poa_setup(void); + void csd_setup(void); + void servant_setup(void); + void collocated_setup(void); + void poa_activate(void); + void run_collocated_clients(void); + void run_orb_event_loop(void); bool check_validity (); void cleanup(); |