Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / RTCORBA / Thread_Pool / test_i.cpp
blobb0ccaf4b360b1ad250de0a4aabadd85b2f04ce2f
1 #include "test_i.h"
2 #include "ace/OS_NS_unistd.h"
3 #include "tao/ORB_Core.h"
4 #include "tao/RTCORBA/Thread_Pool.h"
6 test_i::test_i (CORBA::ORB_ptr orb,
7 PortableServer::POA_ptr poa,
8 long msec_sleep)
9 : orb_ (CORBA::ORB::_duplicate (orb)),
10 poa_ (PortableServer::POA::_duplicate (poa)),
11 nap_time_ ()
13 this->nap_time_.msec (msec_sleep);
16 CORBA::Long
17 test_i::method (CORBA::Long client_id,
18 CORBA::Long iteration)
20 // Get the ORB_Core's TSS resources.
21 TAO_ORB_Core_TSS_Resources *tss =
22 this->orb_->orb_core ()->get_tss_resources ();
24 /// Get the lane attribute in TSS.
25 TAO_Thread_Lane *lane =
26 static_cast <TAO_Thread_Lane *> (tss->lane_);
28 if (lane)
29 ACE_DEBUG ((LM_DEBUG,
30 "Request in thread %t (pool id = %d; lane id = %d) for client %d iteration %d\n",
31 lane->pool ().id (),
32 lane->id (),
33 client_id,
34 iteration));
35 else
36 ACE_DEBUG ((LM_DEBUG,
37 "Request in thread %t (default thread pool) for client %d iteration %d\n",
38 client_id,
39 iteration));
41 ACE_OS::sleep (this->nap_time_);
43 return iteration;
46 PortableServer::POA_ptr
47 test_i::_default_POA (void)
49 return PortableServer::POA::_duplicate (this->poa_.in ());
52 void
53 test_i::shutdown (void)
55 this->orb_->shutdown (0);