TAO_IDL: Fix Memory Leaks Caused By Annotations
[ACE_TAO.git] / TAO / tests / MT_BiDir / Server_Task.cpp
blobc2919011234ec48a40cc883f8b8d2578435b2861
2 #include "Server_Task.h"
3 #include "Sender_i.h"
4 #include "tao/ORB_Core.h"
5 #include "tao/Thread_Lane_Resources.h"
6 #include "tao/Transport_Cache_Manager.h"
7 #include "ace/Manual_Event.h"
9 Server_Task::Server_Task (Sender_i *sender,
10 ACE_Manual_Event &event,
11 int no_iterations,
12 CORBA::ORB_ptr orb,
13 ACE_Thread_Manager *thr_mgr)
14 : ACE_Task_Base (thr_mgr)
15 , sender_ (sender)
16 , event_ (event)
17 , no_iterations_ (no_iterations)
18 , orb_ (CORBA::ORB::_duplicate (orb))
22 int
23 Server_Task::svc (void)
25 ACE_DEBUG ((LM_DEBUG, "(%P|%t) Wait for the Event\n"));
27 /// Wait on the event
28 /// Yes, wait on event twice. One for making sure that we have got
29 /// all the clients come and register with us.
30 this->event_.wait ();
34 ACE_DEBUG ((LM_DEBUG, "(%P|%t) Start doing some work....\n"));
37 try
39 // Before start
40 CORBA::ULong connection_no =
41 this->orb_->orb_core ()->lane_resources ().transport_cache ().current_size ();
43 for (int i = 0; i != this->no_iterations_; ++i)
45 if (i%50 == 0)
46 ACE_DEBUG ((LM_DEBUG, "(%P|%t) Sending message ....\n"));
48 this->sender_->send_message ();
50 // Sanity check for connections..
51 if (connection_no <
52 this->orb_->orb_core ()->lane_resources ().transport_cache ().current_size ())
54 // Get the latest and the greatest..
55 connection_no =
56 this->orb_->orb_core ()->lane_resources ().transport_cache ().current_size ();
57 ACE_ERROR ((LM_DEBUG,
58 "(%P|%t) ERROR: New connections have been created\n"));
59 ACE_ERROR ((LM_DEBUG,
60 "(%P|%t) ERROR: We will crash now...\n"));
61 ACE_OS::abort ();
66 catch (const CORBA::Exception& ex)
68 ex._tao_print_exception ("Caught exception in iteration.\n");
71 return 0;