3 #include "ace/OS_NS_unistd.h"
6 validate_connection (Test::Controller_ptr controller
)
10 #if (TAO_HAS_CORBA_MESSAGING == 1)
11 CORBA::PolicyList_var unused
;
12 controller
->_validate_connection (unused
);
14 controller
->_is_a ("Not_an_IDL_Type");
17 catch (const CORBA::Exception
&)
22 Manager::Manager (CORBA::ORB_ptr orb
)
23 : orb_ (CORBA::ORB::_duplicate (orb
))
28 Manager::start_workers (CORBA::Short worker_count
,
29 CORBA::Long milliseconds
,
30 Test::Controller_ptr controller
)
32 ACE_Thread_Manager thread_manager
;
34 validate_connection(controller
);
36 // ACE_DEBUG ((LM_DEBUG, "Starting %d workers\n", worker_count));
37 Worker
worker (&thread_manager
,
38 controller
, milliseconds
);
40 worker
.activate (THR_NEW_LWP
| THR_JOINABLE
, worker_count
);
42 thread_manager
.wait ();
46 Manager::shutdown (void)
48 this->orb_
->shutdown (0);
52 // ****************************************************************
54 Worker::Worker (ACE_Thread_Manager
*thr_mgr
,
55 Test::Controller_ptr controller
,
56 CORBA::Long milliseconds
)
57 : ACE_Task_Base (thr_mgr
)
58 , controller_ (Test::Controller::_duplicate (controller
))
59 , milliseconds_ (milliseconds
)
66 // ACE_DEBUG ((LM_DEBUG, "Worker starts\n"));
69 validate_connection(this->controller_
.in());
71 this->controller_
->worker_started ();
73 // ACE_DEBUG ((LM_DEBUG, "Worker start reported\n"));
75 ACE_Time_Value
tv (0, 1000 * this->milliseconds_
);
78 this->controller_
->worker_finished ();
80 // ACE_DEBUG ((LM_DEBUG, "Worker completion reported\n"));
82 catch (const CORBA::Exception
& ex
)
84 ex
._tao_print_exception ("Exception in svc() method\n");