int ACE_TMAIN (int, ACE_TCHAR *[]) { Timeout_Handler handler; // Register a 2 second timer. ACE_Time_Value foo_tv (2); if (ACE_Proactor::instance ()->schedule_timer (handler, (void *) "Foo", ACE_Time_Value::zero, foo_tv) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1); // Register a 3 second timer. ACE_Time_Value bar_tv (3); if (ACE_Proactor::instance ()->schedule_timer (handler, (void *) "Bar", ACE_Time_Value::zero, bar_tv) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1); Worker worker; if (worker.activate (THR_NEW_LWP, 10) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p.\n", "main"), -1); ACE_Thread_Manager::instance ()->wait (); return 0; }
int ACE_TMAIN (int /* argc */, ACE_TCHAR * /* argv */ []) { #if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) /// Set the timer for # of threads check at 2 sec. Monitor_Base *num_threads_monitor = create_os_monitor<NUM_THREADS_MONITOR> (0, ACE_Time_Value (2)); /// Runs the reactor's event loop in a separate thread so the timer(s) /// can run concurrently with the application. START_PERIODIC_MONITORS; /// Run the monitor checker in a separate thread. Monitor_Checker monitor_checker; monitor_checker.activate (); /// Spawn 100 threads, sleep until they finish. Worker worker; worker.activate (THR_NEW_LWP | THR_JOINABLE | THR_INHERIT_SCHED, 100); ACE_OS::sleep (6); /// End the reactor's event loop, stopping the timer(s). STOP_PERIODIC_MONITORS; num_threads_monitor->remove_ref (); #endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */ return 0; }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { int result = 0; try { ACE_DEBUG((LM_INFO,"(%P|%t) SERVER START\n")); orb_ = CORBA::ORB_init (argc, argv); CORBA::Object_var obj = orb_->resolve_initial_references("RootPOA"); PortableServer::POA_var poa = PortableServer::POA::_narrow (obj.in()); PortableServer::POAManager_var mgr = poa->the_POAManager (); mgr->activate (); ACE_DEBUG((LM_INFO,"(%P|%t) ORB initialized\n")); Test_Idl_SharedIntf_i* intf_i = new Test_Idl_SharedIntf_i(orb_.in()); PortableServer::ServantBase_var base_var = intf_i; PortableServer::ObjectId_var intfId_var = poa->activate_object(base_var.in()); obj = poa->id_to_reference(intfId_var.in()); Test_Idl::SharedIntf_var intf_var = Test_Idl::SharedIntf::_narrow(obj.in()); CORBA::String_var intfString_var = orb_->object_to_string(intf_var.in()); // Output the IOR to the <ior_output_file> FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); if (output_file == 0) ACE_ERROR_RETURN ((LM_ERROR, "Cannot open output file for writing IOR: %s\n", ior_output_file), 1); ACE_OS::fprintf (output_file, "%s", intfString_var.in ()); ACE_OS::fclose (output_file); intf_i->set_upper (upper_ior); // Running ORB in separate thread Worker worker; if (worker.activate () != 0) ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) %p\n", "Cannot activate server thread(s)"), -1); worker.thr_mgr()->wait (); orb_->destroy(); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Error: Exception caught:"); } ACE_OS::unlink (ior_output_file); return result; }
int create_worker_pool (void) { ACE_GUARD_RETURN (ACE_Thread_Mutex, worker_mon, this->workers_lock_, -1); for (int i = 0; i < POOL_SIZE; i++) { Worker *worker = 0; ACE_NEW_RETURN (worker, Worker (this), -1); this->workers_.enqueue_tail (worker); worker->activate (); } return 0; }
void Manager::start_workers (CORBA::Short worker_count, CORBA::Long milliseconds, Test::Controller_ptr controller) { ACE_Thread_Manager thread_manager; validate_connection(controller); // ACE_DEBUG ((LM_DEBUG, "Starting %d workers\n", worker_count)); Worker worker (&thread_manager, controller, milliseconds); worker.activate (THR_NEW_LWP | THR_JOINABLE, worker_count); thread_manager.wait (); }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { try { CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); if (parse_args (argc, argv) != 0) return 1; CORBA::Object_var object = orb->string_to_object (ior); Simple_Server_var server = Simple_Server::_narrow (object.in ()); if (CORBA::is_nil (server.in ())) { ACE_ERROR_RETURN ((LM_ERROR, "Object reference <%s> is nil.\n", ior), 1); } if (do_shutdown) { server->shutdown (); } else { Worker wrk (server.in ()); wrk.activate (THR_NEW_LWP|THR_JOINABLE|THR_INHERIT_SCHED, nthreads); wrk.thr_mgr ()->wait (); } } catch (const CORBA::Exception& ex) { ACE_DEBUG ((LM_ERROR, ACE_TEXT ("(%P|%t) ERROR: Exception caught: \n%C\n"), ex._info ().c_str ())); return 1; } return 0; }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { g_argc = argc; g_argv = argv; try { if (parse_args (argc, argv) != 0) return 1; if ( g_initInMain ) { initORB(0); } // Run in both main and background thread // else { Worker worker; if (worker.activate (THR_NEW_LWP | THR_JOINABLE, g_nthreads) != 0) ACE_ERROR_RETURN ((LM_ERROR, "Cannot activate ORB thread(s)\n"), 1); worker.thr_mgr ()->wait (); } ACE_DEBUG ((LM_DEBUG, "Event loop finished\n")); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Exception caught:"); return 1; } return 0; }
int main (int, char *[]) { Timeout_Handler handler; ACE_WIN32_Proactor win32_proactor (0, 1); ACE_Proactor proactor (&win32_proactor, 0, 0); ACE_Reactor::instance ()->register_handler (proactor.implementation ()); // Register a 2 second timer. ACE_Time_Value foo_tv (2); if (proactor.schedule_timer (handler, (void *) "Proactor", ACE_Time_Value::zero, foo_tv) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1); // Register a 3 second timer. ACE_Time_Value bar_tv (3); if (ACE_Reactor::instance ()->schedule_timer (&handler, (void *) "Reactor", ACE_Time_Value::zero, bar_tv) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1); Worker worker; if (worker.activate (THR_NEW_LWP, 10) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p.\n", "main"), -1); ACE_Thread_Manager::instance ()->wait (); // Remove from reactor ACE_Reactor::instance ()->remove_handler (&proactor, ACE_Event_Handler::DONT_CALL); return 0; }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { try { CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); CORBA::Object_var poa_object = orb->resolve_initial_references("RootPOA"); if (CORBA::is_nil (poa_object.in ())) ACE_ERROR_RETURN ((LM_ERROR, " (%P|%t) Unable to initialize the POA.\n"), 1); PortableServer::POA_var root_poa = PortableServer::POA::_narrow (poa_object.in ()); PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (); if (parse_args (argc, argv) != 0) return 1; AMI_Test_i ami_test_i (orb.in ()); PortableServer::ObjectId_var id = root_poa->activate_object (&ami_test_i); CORBA::Object_var object = root_poa->id_to_reference (id.in ()); A::AMI_Test_var ami_test_var = A::AMI_Test::_narrow (object.in ()); CORBA::String_var ior = orb->object_to_string (ami_test_var.in ()); ACE_DEBUG ((LM_DEBUG, "Activated as <%C>\n", ior.in ())); // If the ior_output_file exists, output the ior to it if (ior_output_file != 0) { FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); if (output_file == 0) ACE_ERROR_RETURN ((LM_ERROR, "Cannot open output file for writing IOR: %s", ior_output_file), 1); ACE_OS::fprintf (output_file, "%s", ior.in ()); ACE_OS::fclose (output_file); } poa_manager->activate (); Worker worker (orb.in ()); if (worker.activate (THR_NEW_LWP | THR_JOINABLE, nthreads) != 0) ACE_ERROR_RETURN ((LM_ERROR, "Cannot activate client threads\n"), 1); worker.thr_mgr ()->wait (); root_poa->destroy (1, // ethernalize objects 0 // wait for completion ); orb->destroy (); ACE_DEBUG ((LM_DEBUG, "event loop finished\n")); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Caught exception:"); return 1; } return 0; }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { try { CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); if (parse_args (argc, argv) != 0) return 1; Worker worker (orb.in ()); if (worker.activate (THR_NEW_LWP | THR_JOINABLE, nthreads) != 0) ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) Cannot activate worker threads\n"), 1); int timeout = 30; int now = 0; while (now < timeout && ((expect_ex_kind == 0 && !worker.invocation_completed ()) || (expect_ex_kind != 0 && expect_ex_kind != worker.received_ex_kind ())) ) { std::cout << "." << std::flush; now += 1; ACE_Time_Value tv (1, 0); orb->run (tv); } ACE_ASSERT (now != 0); std::cout << std::endl; worker.done (); CORBA::Object_var object = orb->string_to_object (ior); Simple_Server_var server = Simple_Server::_narrow (object.in ()); server->shutdown (); ACE_OS::sleep (1); orb->destroy (); worker.thr_mgr ()->wait (); bool expect_no_ex = expect_ex_kind == TAO::FOE_NON && worker.num_received_ex () == 0 && worker.invocation_completed (); bool expect_ex_received = expect_ex_kind == worker.received_ex_kind () && worker.num_received_ex () > 0 && !worker.invocation_completed (); if (expect_no_ex || expect_ex_received) { ACE_DEBUG ((LM_DEBUG, "(%P|%t)client: test passed.\n")); return 0; } else { ACE_DEBUG ((LM_ERROR, "(%P|%t)client: test failed.\n")); return 1; } } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Exception caught in main:"); return 1; } return 0; }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { try { CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); CORBA::Object_var poa_object = orb->resolve_initial_references("RootPOA"); PortableServer::POA_var root_poa = PortableServer::POA::_narrow (poa_object.in ()); if (CORBA::is_nil (root_poa.in ())) ACE_ERROR_RETURN ((LM_ERROR, " (%P|%t) Panic: nil RootPOA\n"), 1); PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (); if (parse_args (argc, argv) != 0) return 1; TestServer *test_impl = 0; ACE_NEW_RETURN (test_impl, TestServer (), 1); PortableServer::ServantBase_var owner_transfer(test_impl); PortableServer::ObjectId_var id = root_poa->activate_object (test_impl); CORBA::Object_var object = root_poa->id_to_reference (id.in ()); Test::TestServer_var test = Test::TestServer::_narrow (object.in ()); CORBA::String_var ior = orb->object_to_string (test.in ()); // Output the IOR to the <ior_output_file> FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); if (output_file == 0) ACE_ERROR_RETURN ((LM_ERROR, "Cannot open output file for writing IOR: %s\n", ior_output_file), 1); ACE_OS::fprintf (output_file, "%s", ior.in ()); ACE_OS::fclose (output_file); poa_manager->activate (); // Run a CORBA worker thread Worker work (orb.in()); work.activate (THR_NEW_LWP | THR_JOINABLE | THR_INHERIT_SCHED, 1); ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - waiting for client to call\n")); ACE_OS::sleep (10); if (test_impl->got_callback() == false) { ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - client did not make call\n")); return 1; } ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - making repeated calls to client\n")); for (int i = 0; i < 10; i++) { ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - calling client attempt %d\n", i)); test_impl->make_callback(); } ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - stopping client\n")); test_impl->shutdown_client(); ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - test completed\n")); orb->shutdown (); // shutdown our ORB work.wait (); // wait for the worker to finish root_poa->destroy (1, 1); orb->destroy (); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Exception caught:"); return 1; } return 0; }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { CORBA::ORB_var orb_; int result = 0; try { ACE_DEBUG((LM_INFO,"(%P|%t) START OF SERVER TEST\n")); orb_ = CORBA::ORB_init (argc, argv, "myorb-server"); if (parse_args (argc, argv) != 0) return 1; CORBA::Object_var poa_object = orb_->resolve_initial_references("RootPOA"); PortableServer::POA_var root_poa = PortableServer::POA::_narrow (poa_object.in()); PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (); PortableServer::POA_var poa = root_poa; poa_manager->activate (); ACE_DEBUG((LM_INFO,"(%P|%t) ORB initialized\n")); // Creating the servant and activating it // Test_Idl_SharedIntf_i* intf_i = new Test_Idl_SharedIntf_i(orb_.in()); PortableServer::ServantBase_var base_var = intf_i; PortableServer::ObjectId_var intfId_var = poa->activate_object(base_var.in()); CORBA::Object_var obj_var = poa->id_to_reference(intfId_var.in()); Test_Idl::SharedIntf_var intf_var = Test_Idl::SharedIntf::_narrow(obj_var.in()); // Creating stringified IOR of the servant and writing it to a file. // CORBA::String_var intfString_var = orb_->object_to_string(intf_var.in()); // Output the IOR to the <ior_output_file> FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); if (output_file == 0) ACE_ERROR_RETURN ((LM_ERROR, "Cannot open output file for writing IOR: %s\n", ior_output_file), 1); ACE_OS::fprintf (output_file, "%s", intfString_var.in ()); ACE_OS::fclose (output_file); ACE_DEBUG((LM_INFO,"(%P|%t) server IOR to %s\n", ior_output_file)); // Running ORB in separate thread Worker worker (orb_.in ()); if (worker.activate (THR_NEW_LWP | THR_JOINABLE, nr_threads) != 0) ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) %p\n", "Cannot activate server thread(s)"), -1); ACE_DEBUG((LM_INFO,"(%P|%t) Await client initialization\n")); poll ("./client.ior"); ACE_DEBUG((LM_INFO,"(%P|%t) Client IOR file was detected\n")); ACE_Mutex mutex; ACE_Condition<ACE_Mutex> stop_condition (mutex); { ACE_GUARD_RETURN (ACE_Mutex, guard, mutex, -1); Chatter worker2 (orb_.in (), ACE_TEXT("file://client.ior"), stop_condition); if (worker2.activate (THR_NEW_LWP | THR_JOINABLE, 1) != 0) { ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) %p\n", "Cannot activate chatty client threads"), -1); } do { stop_condition.wait (); ACE_DEBUG((LM_INFO,"(%P|%t) So far, %d/%d requests/replies have been processed\n", worker2.nrequests (), worker2.nreplies ())); } while (worker2.nrequests () < 1); worker.thr_mgr()->wait (); root_poa->destroy(1, 1); orb_->destroy(); ACE_DEBUG((LM_INFO,"(%P|%t) Server Test %C\n", (worker2.nrequests() == worker2.nreplies())?"succeeded":"failed")); result = (worker2.nrequests() == worker2.nreplies())? 0 : -1; } } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Error: Exception caught:"); } ACE_OS::unlink ("server.ior"); return result; }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { Fixed_Priority_Scheduler* scheduler=0; RTScheduling::Current_var current; long flags; int sched_policy = ACE_SCHED_RR; int sched_scope = ACE_SCOPE_THREAD; if (sched_policy == ACE_SCHED_RR) flags = THR_NEW_LWP | THR_BOUND | THR_JOINABLE | THR_SCHED_RR; else flags = THR_NEW_LWP | THR_BOUND | THR_JOINABLE | THR_SCHED_FIFO; task_stats.init (100000); try { RTScheduling::Scheduler_var sched_owner; CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); CORBA::Object_var poa_object = orb->resolve_initial_references("RootPOA"); if (CORBA::is_nil (poa_object.in ())) ACE_ERROR_RETURN ((LM_ERROR, " (%P|%t) Unable to initialize the POA.\n"), 1); PortableServer::POA_var root_poa = PortableServer::POA::_narrow (poa_object.in ()); PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (); if (parse_args (argc, argv) != 0) return 1; if (enable_dynamic_scheduling) { CORBA::Object_var manager_obj = orb->resolve_initial_references ("RTSchedulerManager"); TAO_RTScheduler_Manager_var manager = TAO_RTScheduler_Manager::_narrow (manager_obj.in ()); Kokyu::DSRT_Dispatcher_Impl_t disp_impl_type; if (enable_yield) { disp_impl_type = Kokyu::DSRT_CV_BASED; } else { disp_impl_type = Kokyu::DSRT_OS_BASED; } ACE_NEW_RETURN (scheduler, Fixed_Priority_Scheduler (orb.in (), disp_impl_type, sched_policy, sched_scope), -1); sched_owner = scheduler; manager->rtscheduler (scheduler); CORBA::Object_var object = orb->resolve_initial_references ("RTScheduler_Current"); current = RTScheduling::Current::_narrow (object.in ()); } Simple_Server_i server_impl (orb.in (), current.in (), task_stats, enable_yield); Simple_Server_var server = server_impl._this (); CORBA::String_var ior = orb->object_to_string (server.in ()); ACE_DEBUG ((LM_DEBUG, "Activated as <%C>\n", ior.in ())); // If the ior_output_file exists, output the ior to it if (ior_output_file != 0) { FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); if (output_file == 0) ACE_ERROR_RETURN ((LM_ERROR, "Cannot open output file for writing IOR: %s", ior_output_file), 1); ACE_OS::fprintf (output_file, "%s", ior.in ()); ACE_OS::fclose (output_file); } poa_manager->activate (); Worker worker (orb.in ()); if (worker.activate (flags, nthreads, 0, ACE_Sched_Params::priority_max(sched_policy, sched_scope)) != 0) { ACE_ERROR ((LM_ERROR, "Cannot activate threads in RT class.", "Trying to activate in non-RT class\n")); flags = THR_NEW_LWP | THR_JOINABLE | THR_BOUND; if (worker.activate (flags, nthreads) != 0) { ACE_ERROR_RETURN ((LM_ERROR, "Cannot activate server threads\n"), 1); } } worker.wait (); ACE_DEBUG ((LM_DEBUG, "event loop finished\n")); ACE_DEBUG ((LM_DEBUG, "shutting down scheduler\n")); scheduler->shutdown (); orb->destroy (); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Exception caught:"); return 1; } ACE_DEBUG ((LM_DEBUG, "Exiting main...\n")); task_stats.dump_samples (ACE_TEXT("timeline.txt"), ACE_TEXT("Time\t\tGUID")); return 0; }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { try { CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); if (parse_args (argc, argv) != 0) return 1; Worker worker (orb.in ()); if (worker.activate (THR_NEW_LWP | THR_JOINABLE, nthreads) != 0) ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) Cannot activate worker threads\n"), 1); int timeout = 30; int now = 0; while (now < timeout && worker.got_object_not_exist () != expected_object_not_exist) { now += 5; ACE_Time_Value tv (5, 0); orb->run (tv); } if (do_shutdown) { CORBA::Object_var object = orb->string_to_object (ior); Simple_Server_var server = Simple_Server::_narrow (object.in ()); server->shutdown (); } orb->shutdown (); worker.thr_mgr ()->wait (); orb->destroy (); if (worker.got_object_not_exist () != expected_object_not_exist) { ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t)client: test failed.\n"), 1); } else { ACE_DEBUG ((LM_DEBUG, "(%P|%t)client: test passed.\n")); } } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Exception caught in main:"); return 1; } return 0; }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { try { CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); if (parse_args (argc, argv) != 0) return 1; Worker worker (orb.in ()); if (worker.activate (THR_NEW_LWP | THR_JOINABLE, nthreads) != 0) ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) Cannot activate worker threads\n"), 1); int timeout = 30; int now = 0; while (now < timeout && ((expect_ex_kind != TAO::FOE_NON && worker.received_ex_kind () != expect_ex_kind && worker.num_received_ex () != expect_num_ex) || expect_ex_kind == TAO::FOE_NON)) { std::cout << "."; now += 1; ACE_Time_Value tv (1, 0); orb->run (tv); } std::cout << std::endl; worker.done (); if (do_shutdown) { CORBA::Object_var object = orb->string_to_object (ior); Simple_Server_var server = Simple_Server::_narrow (object.in ()); server->shutdown (); } ACE_OS::sleep (1); orb->destroy (); worker.thr_mgr ()->wait (); if (worker.received_ex_kind () != expect_ex_kind || worker.num_received_ex () != expect_num_ex) { ACE_ERROR_RETURN ((LM_ERROR, ("(%P|%t)client: test failed - expected is different from received. " "expected %d/%d received %d/%d.\n"), expect_ex_kind, expect_num_ex, worker.received_ex_kind (), worker.num_received_ex()), 1); } ACE_DEBUG ((LM_DEBUG, "(%P|%t)client: test passed.\n")); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Exception caught in main:"); return 1; } return 0; }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { int result = 1; try { CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); if (parse_args (argc, argv) != 0) return 1; CORBA::Object_var tmp = orb->string_to_object(ior); Test::Server_var test_server = Test::Server::_narrow(tmp.in ()); if (CORBA::is_nil (test_server.in ())) ACE_ERROR_RETURN ((LM_DEBUG, "ERROR: Nil reference in Test::Server reference <%s>\n", ior), 1); CORBA::Any scope_as_any; scope_as_any <<= Messaging::SYNC_NONE; CORBA::PolicyList policies(1); policies.length (1); policies[0] = orb->create_policy (Messaging::SYNC_SCOPE_POLICY_TYPE, scope_as_any); tmp = test_server->_set_policy_overrides (policies, CORBA::ADD_OVERRIDE); policies[0]->destroy (); Test::Server_var test_server_no_sync = Test::Server::_narrow(tmp.in ()); if (CORBA::is_nil (test_server_no_sync.in ())) ACE_ERROR_RETURN ((LM_DEBUG, "ERROR: Nil reference in Test::Server reference <%s>\n", ior), 1); CORBA::Object_var poa_object = orb->resolve_initial_references("RootPOA"); if (CORBA::is_nil (poa_object.in ())) ACE_ERROR_RETURN ((LM_ERROR, " (%P|%t) Unable to initialize the POA.\n"), 1); PortableServer::POA_var root_poa = PortableServer::POA::_narrow (poa_object.in ()); PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (); poa_manager->activate (); Worker worker (orb.in ()); if (worker.activate (THR_NEW_LWP | THR_JOINABLE, 1) != 0) ACE_ERROR_RETURN ((LM_ERROR, "Cannot activate client server thread\n"), 1); ACE_DEBUG ((LM_DEBUG, "(%P|%t) Test starting . . .\n")); Client client_impl; PortableServer::ObjectId_var id = root_poa->activate_object (&client_impl); tmp = root_poa->id_to_reference (id.in ()); Test::Client_var test_client = Test::Client::_narrow (tmp.in ()); // setup client callback at server test_server_no_sync->setup (test_client.in ()); // send oneway request to server test_server_no_sync->request (1); // sleep 2 sec to give ample opportunity for oneway reply to be received by worker ACE_OS::sleep (2); // check if reply received if (client_impl.reply_count () > 0) { ACE_DEBUG ((LM_INFO, "(%P|%t) Oneway reply correctly received\n")); result = 0; // test OK } else { ACE_ERROR ((LM_ERROR, "(%P|%t) ERROR: Oneway reply not received\n")); // send second request to trigger reception of first and second reply test_server_no_sync->request (2); // sleep 2 sec to give ample opportunity for oneway reply to be received by worker ACE_OS::sleep (2); if (client_impl.reply_count () > 1) { ACE_DEBUG ((LM_INFO, "(%P|%t) Received both replies after second request\n")); } else { ACE_ERROR ((LM_ERROR, "(%P|%t) FATAL ERROR: Still no replies received\n")); } } // shutdown server (use original synchronous reference to be sure to deliver message) test_server->shutdown (); // shutdown worker orb->shutdown (1); worker.thr_mgr ()->wait (); orb->destroy (); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Exception caught:"); return 1; } return result; }
int server_main (int argc, ACE_TCHAR *argv[], Test::Server_Request_Interceptor *cri) { #if TAO_HAS_TRANSPORT_CURRENT == 1 try { PortableInterceptor::ORBInitializer_ptr temp_initializer = 0; ACE_NEW_RETURN (temp_initializer, Test::Server_ORBInitializer (cri), -1); // No exceptions yet! PortableInterceptor::ORBInitializer_var orb_initializer (temp_initializer); PortableInterceptor::register_orb_initializer (orb_initializer.in ()); CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "test_orb"); CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA"); PortableServer::POA_var root_poa = PortableServer::POA::_narrow (obj.in ()); if (CORBA::is_nil (root_poa.in ())) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Server (%P|%t) Unable to obtain") ACE_TEXT (" RootPOA reference.\n")), -1); PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (); poa_manager->activate (); if (parse_args (argc, argv) != 0) return -1; Current_Test_Impl server_impl (orb.in (), root_poa.in (), use_collocated_call); obj = server_impl._this (); Test::Transport::CurrentTest_var server = Test::Transport::CurrentTest::_narrow (obj.in ()); if (CORBA::is_nil (server.in ())) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Server (%P|%t) Unable to obtain ") ACE_TEXT ("reference to CurrentTest object.\n")), -1); CORBA::String_var ior = orb->object_to_string (server.in ()); // If the ior_output_file exists, output the IOR to it. if (ior_output_file != 0) { FILE *output_file = ACE_OS::fopen (ior_output_file, "w"); if (output_file == 0) ACE_ERROR_RETURN ((LM_ERROR, "Server (%P|%t) Cannot write %s " "IOR: %C - %m", ior_output_file, ior.in ()), -1); ACE_OS::fprintf (output_file, "%s", ior.in ()); ACE_OS::fclose (output_file); } // Spawn a number of clients doing the same thing for a // predetermined number of times Worker worker (orb.in ()); #if defined (ACE_HAS_THREADS) if (worker.activate (THR_NEW_LWP | THR_JOINABLE, nthreads) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Server (%P|%t) Cannot activate %d threads\n"), nthreads), -1); //FUZZ: disable check_for_lack_ACE_OS if(worker.thr_mgr ()->wait () != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Server (%P|%t) wait() Cannot wait for all %d threads\n"), nthreads), -1); //FUZZ: enable check_for_lack_ACE_OS #else if (nthreads > 1) ACE_ERROR ((LM_WARNING, ACE_TEXT ("Server (%P|%t) Cannot use threads other than ") ACE_TEXT ("the only one available.\n"))); worker.svc (); #endif if (TAO_debug_level >= 1) ACE_DEBUG ((LM_INFO, ACE_TEXT ("Server (%P|%t) Event loop finished.\n"))); if (!cri->self_test ()) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Server (%P|%t) ERROR: Interceptor self_test failed\n"))); root_poa->destroy (1, 1); server->shutdown (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Server (%P|%t) Invoking orb->destroy ()\n"))); orb->destroy (); } catch (const CORBA::Exception& ex) { ex._tao_print_exception (ACE_TEXT ("Server (%P|%t) ERROR: ")); return -1; } ACE_DEBUG ((LM_INFO, ACE_TEXT ("Server (%P|%t) Completed successfuly.\n"))); return 0; #else /* TAO_HAS_TRANSPORT_CURRENT == 1 */ ACE_DEBUG ((LM_INFO, ACE_TEXT ("Server (%P|%t) Need TAO_HAS_TRANSPORT_CURRENT enabled to run.\n"))); return 0; #endif /* TAO_HAS_TRANSPORT_CURRENT == 1 */ }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { try { CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); CORBA::Object_var poa_object = orb->resolve_initial_references("RootPOA"); if (CORBA::is_nil (poa_object.in ())) ACE_ERROR_RETURN ((LM_ERROR, " (%P|%t) Unable to initialize the POA.\n"), 1); PortableServer::POA_var root_poa = PortableServer::POA::_narrow (poa_object.in ()); PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (); if (parse_args (argc, argv) != 0) return 1; Simple_Server_i server_impl (orb.in ()); PortableServer::ObjectId_var id = root_poa->activate_object (&server_impl); CORBA::Object_var object = root_poa->id_to_reference (id.in ()); Simple_Server_var server = Simple_Server::_narrow (object.in ()); CORBA::String_var local_ior = orb->object_to_string (server.in ()); ACE_DEBUG ((LM_DEBUG, "Client interface started on <%C>\n", local_ior.in ())); CORBA::Object_var remote_object = orb->string_to_object (ior); Simple_Server_var remote_server = Simple_Server::_narrow (remote_object.in ()); if (CORBA::is_nil (remote_server.in ())) { ACE_ERROR_RETURN ((LM_ERROR, "Object reference <%s> is nil\n", ior), 1); } if (do_shutdown) { remote_server->shutdown (); } else { poa_manager->activate (); Worker worker (orb.in ()); if (worker.activate (THR_NEW_LWP | THR_JOINABLE, 1) != 0) ACE_ERROR_RETURN ((LM_ERROR, "Cannot activate client thread\n"), 1); ACE_DEBUG ((LM_DEBUG, "ORB Thread started\n")); CORBA::String_var str = remote_server->test_method (server.in ()); ACE_DEBUG ((LM_DEBUG, "Received \"%C\"\n", str.in ())); orb->shutdown (true); worker.thr_mgr ()->wait (); ACE_DEBUG ((LM_DEBUG, "ORB Thread completed\n")); } orb->destroy (); } catch (CORBA::Exception& ex) { ACE_DEBUG ((LM_ERROR, ACE_TEXT ("(%P|%t) Exception caught: \n%s\n"), ACE_TEXT_CHAR_TO_TCHAR (ex._info ().c_str ()))); return 1; } return 0; }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { try { CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); if (parse_args (argc, argv) != 0) return 1; A::AMI_Test_var server; CORBA::Object_var object = orb->string_to_object (ior); server = A::AMI_Test::_narrow (object.in ()); if (CORBA::is_nil (server.in ())) { ACE_ERROR_RETURN ((LM_ERROR, "Object reference <%s> is nil.\n", ior), 1); } // Activate POA to handle the call back. CORBA::Object_var poa_object = orb->resolve_initial_references("RootPOA"); if (CORBA::is_nil (poa_object.in ())) ACE_ERROR_RETURN ((LM_ERROR, " (%P|%t) Unable to initialize the POA.\n"), 1); PortableServer::POA_var root_poa = PortableServer::POA::_narrow (poa_object.in ()); PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (); poa_manager->activate (); // Let the client perform the test in a separate thread Handler handler; PortableServer::ObjectId_var id = root_poa->activate_object (&handler); CORBA::Object_var hnd_object = root_poa->id_to_reference (id.in ()); A::AMI_AMI_TestHandler_var the_handler_var = A::AMI_AMI_TestHandler::_narrow (hnd_object.in ()); handler.set_ami_test (server.in ()); Client client (server.in (), niterations, the_handler_var.in ()); if (client.activate (THR_NEW_LWP | THR_JOINABLE, nthreads) != 0) ACE_ERROR_RETURN ((LM_ERROR, "Cannot activate client threads\n"), 1); // Main thread collects replies. It needs to collect // <nthreads*niterations> replies. number_of_replies = nthreads *niterations; if (debug) { ACE_DEBUG ((LM_DEBUG, "(%P|%t) : Entering perform_work loop to receive <%d> replies\n", number_of_replies.value ())); } // ORB loop. Worker worker (orb.in ()); if (worker.activate (THR_NEW_LWP | THR_JOINABLE, nthreads) != 0) ACE_ERROR_RETURN ((LM_ERROR, "Cannot activate client threads\n"), 1); worker.thr_mgr ()->wait (); if (debug) { ACE_DEBUG ((LM_DEBUG, "(%P|%t) : Exited perform_work loop Received <%d> replies\n", (nthreads*niterations) - number_of_replies.value ())); } client.thr_mgr ()->wait (); ACE_DEBUG ((LM_DEBUG, "threads finished\n")); server->shutdown (); root_poa->destroy (1, // ethernalize objects 0 // wait for completion ); orb->destroy (); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Caught exception:"); return 1; } return parameter_corruption; }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { try { // Initialize the ORB CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); // Get initial reference to the Root POA CORBA::Object_var poa_object = orb->resolve_initial_references("RootPOA"); // Narrow down to the appropriate type PortableServer::POA_var root_poa = PortableServer::POA::_narrow (poa_object.in ()); if (CORBA::is_nil (root_poa.in ())) ACE_ERROR_RETURN ((LM_ERROR, " (%P|%t) Panic: nil RootPOA\n"), 1); // Get referencee to the POA manager PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (); // Parse the arguments if (parse_args (argc, argv) != 0) return 1; ACE_DEBUG(( LM_DEBUG, "ior file = %s\t#threads = %d\t" "msglen = %d\n", ior_output_file, nthreads, msglen)); // Create the factory servant Object_Factory_i *factory_impl = 0; ACE_NEW_THROW_EX (factory_impl, Object_Factory_i (orb.in (), msglen), CORBA::NO_MEMORY ()); PortableServer::ServantBase_var safe (factory_impl); // _this method registers the object withe the POA and returns // an object reference PortableServer::ObjectId_var id = root_poa->activate_object (factory_impl); CORBA::Object_var object_act = root_poa->id_to_reference (id.in ()); Two_Objects_Test::Object_Factory_var factory = Two_Objects_Test::Object_Factory::_narrow (object_act.in ()); // Convert the object reference to a string so that it can // be saved in a file and used by clinet programs later CORBA::String_var ior = orb->object_to_string (factory.in ()); // If the ior_output_file exists, output the ior to it FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); if (output_file == 0) ACE_ERROR_RETURN ((LM_ERROR, "Cannot open output file for writing IOR: %s", ior_output_file), 1); ACE_OS::fprintf (output_file, "%s", ior.in ()); ACE_OS::fclose (output_file); // Activate the POA manager poa_manager->activate (); // Instantiate the specified # of worker threads Worker worker (orb.in ()); if (worker.activate (THR_NEW_LWP | THR_JOINABLE, nthreads) != 0) ACE_ERROR_RETURN ((LM_ERROR, "Cannot activate server threads\n"), 1); // Wait for all threads to get done worker.thr_mgr ()->wait (); ACE_DEBUG ((LM_DEBUG, "(%P|%t) event loop finished\n")); root_poa->destroy (1, 1); orb->destroy (); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Exception caught:"); return 1; } return 0; }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { try { CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); CORBA::Object_var poa_object = orb->resolve_initial_references ("RootPOA"); if (CORBA::is_nil (poa_object.in ())) ACE_ERROR_RETURN ((LM_ERROR, " (%P|%t) Unable to initialize the POA.\n"), 1); PortableServer::POA_var root_poa = PortableServer::POA::_narrow (poa_object.in ()); PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (); if (parse_args (argc, argv) != 0) return 1; Simple_Server_i *server_impl = 0; ACE_NEW_RETURN (server_impl, Simple_Server_i (orb.in ()), -1); PortableServer::ServantBase_var owner_transfer(server_impl); PortableServer::ObjectId_var id = root_poa->activate_object (server_impl); CORBA::Object_var object = root_poa->id_to_reference (id.in ()); Simple_Server_var server = Simple_Server::_narrow (object.in ()); CORBA::String_var ior = orb->object_to_string (server.in ()); ACE_DEBUG ((LM_DEBUG, "Activated as <%C>\n", ior.in ())); // If the ior_output_file exists, output the ior to it if (ior_output_file != 0) { FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); if (output_file == 0) ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) Cannot open output file for writing IOR: %s", ior_output_file), 1); ACE_OS::fprintf (output_file, "%s", ior.in ()); ACE_OS::fclose (output_file); } poa_manager->activate (); Worker worker (orb.in ()); if (worker.activate (THR_NEW_LWP | THR_JOINABLE, nthreads) != 0) ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) Cannot activate client threads\n"), 1); SelfClient selfabuse (orb.in(), server.in(), niterations); if (selfabuse.activate (THR_NEW_LWP | THR_JOINABLE, nclient_threads) != 0) ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) Cannot activate abusive threads\n"), 1); selfabuse.thr_mgr()->wait(); worker.thr_mgr ()->wait (); ACE_DEBUG ((LM_DEBUG, "(%P|%t) event loop finished\n")); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Exception caught:"); return 1; } return 0; }
/// The main driver int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { #if TAO_HAS_TRANSPORT_CURRENT == 1 try { Test::Client_Request_Interceptor* cri = 0; ACE_NEW_RETURN (cri, Test::Client_Request_Interceptor (CLIENT_ORB_ID, test_transport_current), -1); PortableInterceptor::ClientRequestInterceptor_var cri_safe (cri); PortableInterceptor::ORBInitializer_ptr temp_initializer = 0; ACE_NEW_RETURN (temp_initializer, Test::Client_ORBInitializer (cri), -1); PortableInterceptor::ORBInitializer_var orb_initializer (temp_initializer); PortableInterceptor::register_orb_initializer (orb_initializer.in ()); CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, CLIENT_ORB_ID); if (parse_args (argc, argv) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Client (%P|%t) Failure to parse the command line.\n"), ior), -1); try { test_transport_current (orb.in ()); ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Client (%P|%t) ERROR: ") ACE_TEXT ("TC invocation, outside of ") ACE_TEXT ("interceptor context is undefined.") ACE_TEXT (" Expected exception was not thrown\n")), -1); } catch (const Transport::NoContext& ) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Client (%P|%t) Expected exception occured when trying ") ACE_TEXT ("to access traits outside the ") ACE_TEXT ("interceptor or upcall context.\n"))); } // Resolve the target object CORBA::Object_var obj = orb->string_to_object (ior); Test::Transport::CurrentTest_var server = Test::Transport::CurrentTest::_narrow (obj.in ()); if (CORBA::is_nil (server.in ())) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Client (%P|%t) The server object reference <%s> is nil.\n"), ior), -1); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Client (%P|%t) Spawning %d threads\n"), nthreads)); // Spawn a number of clients doing the same thing for a // predetermined number of times Worker client (server.in (), niterations, use_dii); #if defined (ACE_HAS_THREADS) if (client.activate (THR_NEW_LWP | THR_JOINABLE, nthreads) != 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Client (%P|%t) Cannot activate %d client threads\n"), nthreads), -1); client.thr_mgr ()->wait (); #else if (nthreads > 1) ACE_ERROR ((LM_WARNING, ACE_TEXT ("Client (%P|%t) Cannot use threads other than ") ACE_TEXT ("the only one available.\n"))); client.svc (); #endif ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Client (%P|%t) Collected any threads\n"))); CORBA::Long result = 0; // Verify enough interception points have been triggered if (cri->interceptions () != 2 * // request & response niterations * // iterations nthreads * // threads (2*use_dii)) // sii and dii, if needed { ACE_ERROR ((LM_ERROR, ACE_TEXT ("Client (%P|%t) Expected %d client-side interceptions, but detected %d\n"), 2 * niterations * nthreads * (2*use_dii), cri->interceptions ())); } else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Client (%P|%t) Invoking server->self_test()\n"))); // Self-test the server side result = server->self_test (); if (result != 0) ACE_ERROR ((LM_ERROR, ACE_TEXT ("Client (%P|%t) Server self-test reported failure\n"))); } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Client (%P|%t) Invoking oneway server->shutdown()\n"))); server->shutdown (); orb->destroy (); ACE_DEBUG ((LM_INFO, ACE_TEXT ("Client (%P|%t) Completed %s\n"), ((result == 0) ? ACE_TEXT ("successfuly") : ACE_TEXT ("with failure")))); return result; } catch (const CORBA::Exception& ex) { ex._tao_print_exception ( ACE_TEXT ( "Client: Transport Current test (client-side) failed:")); return -1; } #else /* TAO_HAS_TRANSPORT_CURRENT == 1 */ ACE_DEBUG ((LM_INFO, ACE_TEXT ("Client (%P|%t) Need TAO_HAS_TRANSPORT_CURRENT enabled to run.\n"))); return 0; #endif /* TAO_HAS_TRANSPORT_CURRENT == 1 */ }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { int priority = (ACE_Sched_Params::priority_min (ACE_SCHED_FIFO) + ACE_Sched_Params::priority_max (ACE_SCHED_FIFO)) / 2; priority = ACE_Sched_Params::next_priority (ACE_SCHED_FIFO, priority); priority = ACE_Sched_Params::next_priority (ACE_SCHED_FIFO, priority); // Enable FIFO scheduling, e.g., RT scheduling class on Solaris. if (ACE_OS::sched_params (ACE_Sched_Params (ACE_SCHED_FIFO, priority, ACE_SCOPE_PROCESS)) != 0) { if (ACE_OS::last_error () == EPERM) { ACE_DEBUG ((LM_DEBUG, "server (%P|%t): user is not superuser, " "test runs in time-shared class\n")); } else ACE_ERROR ((LM_ERROR, "server (%P|%t): sched_params failed\n")); } try { CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); CORBA::Object_var poa_object = orb->resolve_initial_references("RootPOA"); if (CORBA::is_nil (poa_object.in ())) ACE_ERROR_RETURN ((LM_ERROR, " (%P|%t) Unable to initialize the POA.\n"), 1); PortableServer::POA_var root_poa = PortableServer::POA::_narrow (poa_object.in ()); PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (); poa_manager->activate (); if (parse_args (argc, argv) != 0) return 1; CORBA::Object_var progress_object = orb->string_to_object (ior); Progress_var progress = Progress::_narrow (progress_object.in ()); ACE_Time_Value delay (0, interval); Peer_i peer; peer.init (orb.in (), progress.in (), delay); Worker worker (orb.in ()); if (worker.activate (THR_NEW_LWP | THR_JOINABLE, nthreads) != 0) ACE_ERROR_RETURN ((LM_ERROR, "Cannot activate client threads\n"), 1); worker.thr_mgr ()->wait (); ACE_DEBUG ((LM_DEBUG, "event loop finished\n")); } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("Caught exception:"); return 1; } return 0; }
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) { static const int orb_threads = 5; static const int total_threads = 15; // It must be ensured that there are more total threads that there are // that are dedicated to running the ORB. ACE_ASSERT (total_threads > orb_threads); Worker worker (orb_threads); try { worker.orb_ = CORBA::ORB_init (argc, argv, "test"); if (parse_args (argc, argv) != 0) return 1; ACE_DEBUG ((LM_DEBUG,"using ior = %s\n",ior)); CORBA::Object_var tmp = worker.orb_->string_to_object(ior); if (CORBA::is_nil (tmp.in ())) { ACE_ERROR_RETURN ((LM_ERROR, "Invalid IOR.\n") ,1); } worker.hello_ = Test::Hello::_narrow(tmp.in ()); if (CORBA::is_nil (worker.hello_.in ())) { ACE_ERROR_RETURN ((LM_ERROR, "Nil Test::Hello reference <%s>\n", ior), 1); } // bool x = worker.hello_->_non_existent(); // ACE_DEBUG ((LM_DEBUG, "_non_existent returned %d\n",x)); { // Set the Synch Scopes CORBA::Any scope_as_any; ACE_DEBUG ((LM_DEBUG, "(%P|%t) - Applying SYNC_NONE.\n")); scope_as_any <<= Messaging::SYNC_NONE; CORBA::PolicyList policies (1); policies.length (1); policies[0] = worker.orb_->create_policy (Messaging::SYNC_SCOPE_POLICY_TYPE, scope_as_any); ACE_DEBUG ((LM_DEBUG, "(%P|%t) - Applying Synch Scope at Object level.\n")); tmp = tmp->_set_policy_overrides (policies, CORBA::SET_OVERRIDE); policies[0]->destroy (); } worker.asynch_hello_ = Test::Hello::_narrow(tmp.in ()); if (CORBA::is_nil (worker.asynch_hello_.in ())) { ACE_ERROR_RETURN ((LM_ERROR, "Nil Test::Hello reference <%s>\n", ior), 1); } init_callback(worker); } catch (CORBA::Exception &ex) { ACE_ERROR ((LM_ERROR, "Exception caught: %s\"%s\"\n" , ex._name(), ex._rep_id ())); return 1; } worker.activate (THR_NEW_LWP | THR_JOINABLE, total_threads); worker.wait(); return 0; }