Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / RTCORBA / Bug_3643_Regression / test_i.cpp
blobf619d77831a0ba09124d247ba020fdd917a7365d
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,
19 CORBA::Long_out thread_count)
21 // Get the ORB_Core's TSS resources.
22 TAO_ORB_Core_TSS_Resources *tss =
23 this->orb_->orb_core ()->get_tss_resources ();
25 /// Get the lane attribute in TSS.
26 TAO_Thread_Lane *lane =
27 static_cast <TAO_Thread_Lane *> (tss->lane_);
29 if (lane)
30 ACE_DEBUG ((LM_DEBUG,
31 "Request in thread %t (pool id = %d; lane id = %d) for client %d iteration %d\n",
32 lane->pool ().id (),
33 lane->id (),
34 client_id,
35 iteration));
36 else
37 ACE_DEBUG ((LM_DEBUG,
38 "Request in thread %t (default thread pool) for client %d iteration %d\n",
39 client_id,
40 iteration));
42 ACE_OS::sleep (this->nap_time_);
44 if (lane)
45 thread_count = lane->current_threads ();
46 else
47 thread_count = 0;
49 return iteration;
52 PortableServer::POA_ptr
53 test_i::_default_POA (void)
55 return PortableServer::POA::_duplicate (this->poa_.in ());
58 void
59 test_i::shutdown (void)
61 this->orb_->shutdown (0);