diff options
Diffstat (limited to 'TAO/tests/CSD_Strategy_Tests/Broken/ServerApp.cpp')
-rw-r--r-- | TAO/tests/CSD_Strategy_Tests/Broken/ServerApp.cpp | 133 |
1 files changed, 52 insertions, 81 deletions
diff --git a/TAO/tests/CSD_Strategy_Tests/Broken/ServerApp.cpp b/TAO/tests/CSD_Strategy_Tests/Broken/ServerApp.cpp index e48955f8c06..4d4f7b2af52 100644 --- a/TAO/tests/CSD_Strategy_Tests/Broken/ServerApp.cpp +++ b/TAO/tests/CSD_Strategy_Tests/Broken/ServerApp.cpp @@ -32,29 +32,21 @@ ServerApp::~ServerApp() int -ServerApp::run_i(int argc, char* argv[] ACE_ENV_ARG_DECL) +ServerApp::run_i(int argc, char* argv[]) { - int result = this->init(argc, argv ACE_ENV_ARG_PARAMETER); - if (result != 0) + int result = this->init(argc, argv); + 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->run_orb_event_loop(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(); + 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. @@ -68,10 +60,9 @@ ServerApp::run_i(int argc, char* argv[] ACE_ENV_ARG_DECL) int -ServerApp::init(int argc, char* argv[] ACE_ENV_ARG_DECL) +ServerApp::init(int argc, char* argv[]) { - this->orb_ = CORBA::ORB_init(argc, argv, "" ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); + this->orb_ = CORBA::ORB_init(argc, argv, ""); // Parse the command-line args for this application. // * Raises -1 if problems are encountered. @@ -86,49 +77,43 @@ ServerApp::init(int argc, char* argv[] ACE_ENV_ARG_DECL) unsigned num_clients = this->num_remote_clients_ + this->num_collocated_clients_; - TheAppShutdown->init(this->orb_.in(), num_clients ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); + TheAppShutdown->init(this->orb_.in(), num_clients); return 0; } void -ServerApp::poa_setup(ACE_ENV_SINGLE_ARG_DECL) +ServerApp::poa_setup(void) { - this->poa_ = this->create_poa(this->orb_.in(), - "ChildPoa" - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - + this->poa_ = this->create_poa(this->orb_.in(), + "ChildPoa"); + if (this->num_collocated_clients_ > 0) { - this->cb_poa_ = this->create_poa(this->orb_.in(), - "CallbackPoa" - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; + this->cb_poa_ = this->create_poa(this->orb_.in(), + "CallbackPoa"); } } 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_); // We don't apply the strategy for this test to show that the bug isn't // part of the CSD ThreadPool Strategy code. #if 0 - if (!this->tp_strategy_->apply_to(this->poa_.in() ACE_ENV_ARG_PARAMETER)) + if (!this->tp_strategy_->apply_to(this->poa_.in())) { ACE_ERROR((LM_ERROR, "Failed to apply CSD strategy to poa.\n")); - ACE_THROW(TestAppException()); + throw TestAppException(); } - ACE_CHECK; #endif // 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) { @@ -136,43 +121,38 @@ ServerApp::csd_setup(ACE_ENV_SINGLE_ARG_DECL) // We don't apply the strategy for this test to show that the bug isn't // part of the CSD ThreadPool Strategy code. #if 0 - if (!this->cb_tp_strategy_->apply_to(this->cb_poa_.in() ACE_ENV_ARG_PARAMETER)) + if (!this->cb_tp_strategy_->apply_to(this->cb_poa_.in())) { ACE_ERROR((LM_ERROR, "Failed to apply CSD strategy to callback poa.\n")); - ACE_THROW(TestAppException()); - } - ACE_CHECK; + throw TestAppException(); + } #endif } } 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; + this->ior_filename_prefix_.c_str()); } void -ServerApp::collocated_setup(ACE_ENV_SINGLE_ARG_DECL) +ServerApp::collocated_setup(void) { if (this->num_collocated_clients_ == 0) return; this->cb_servants_.create_and_activate(1, // number of callback servants - this->cb_poa_.in() - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; + this->cb_poa_.in()); 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++) @@ -181,9 +161,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_SimpleClientEngine(foo.in(), cb.in (), client_id, true); this->collocated_client_task_.add_engine(engine.in()); } @@ -191,35 +171,32 @@ 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) { if (this->collocated_client_task_.open() == -1) { - ACE_THROW (TestAppException ()); + throw TestAppException (); } } } 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 (); } @@ -332,7 +309,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; } @@ -361,21 +338,17 @@ ServerApp::set_arg(unsigned& value, PortableServer::POA_ptr -ServerApp::create_poa(CORBA::ORB_ptr orb, - const char* poa_name - ACE_ENV_ARG_DECL) +ServerApp::create_poa(CORBA::ORB_ptr orb, + const char* poa_name) { // Get the Root POA. PortableServer::POA_var root_poa - = RefHelper<PortableServer::POA>::resolve_initial_ref(orb, - "RootPOA" - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (PortableServer::POA::_nil ()); + = RefHelper<PortableServer::POA>::resolve_initial_ref(orb, + "RootPOA"); // 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); @@ -385,9 +358,7 @@ ServerApp::create_poa(CORBA::ORB_ptr orb, PortableServer::POA_var poa = AppHelper::create_poa(poa_name, root_poa.in(), poa_manager.in(), - policies - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (PortableServer::POA::_nil ()); + policies); // Give away the child POA_ptr from the POA_var variable. return poa._retn(); @@ -400,7 +371,7 @@ ServerApp::check_validity () return true; #if 0 // 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; @@ -408,7 +379,7 @@ ServerApp::check_validity () Foo_B_Statistics stats (this->num_remote_clients_, this->num_collocated_clients_); - + Foo_B_SimpleClientEngine::expected_results (stats); for (unsigned i = 0; i < this->num_servants_; i++) |