Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tests / BiDirectional_DelayedUpcall / test_i.cpp
bloba7c003f47889374ec5c7aa00ce21ff3c040fe018
1 #include "test_i.h"
2 #include "tao/ORB_Core.h"
3 #include "tao/debug.h"
4 #include "tao/Transport_Cache_Manager.h"
5 #include "tao/Thread_Lane_Resources.h"
6 #include "ace/Reactor.h"
8 #if !defined(__ACE_INLINE__)
9 #include "test_i.inl"
10 #endif /* __ACE_INLINE__ */
12 void
13 Callback_i::shutdown ()
15 ACE_DEBUG ((LM_DEBUG, "Performing clean shutdown\n"));
16 // Shutdown the server before we shutdown our own ORB
17 this->server_->shutdown ();
18 // now we shut down
19 this->orb_->shutdown (false);
22 void
23 Callback_i::callback_method ()
25 if (TAO_debug_level > 0)
26 ACE_DEBUG ((LM_DEBUG, "Callback method called\n"));
30 // ****************************************************************
32 int
33 Simple_Server_i::handle_timeout (const ACE_Time_Value &,
34 const void *)
36 if (TAO_debug_level > 0)
37 ACE_DEBUG ((LM_DEBUG,
38 ACE_TEXT ("About to make a remote call in the Upcall\n")));
40 for (int times = 0;
41 times < this->no_iterations_;
42 ++times)
44 this->callback_->callback_method ();
46 if (this->orb_->orb_core ()->lane_resources ().transport_cache ().current_size () > 1)
48 ACE_ERROR ((LM_ERROR,
49 "(%P|%t) The cache has grown, aborting ..\n"));
51 ACE_OS::abort ();
55 this->callback_->shutdown ();
57 return 0;
60 CORBA::Long
61 Simple_Server_i::test_method (CORBA::Boolean do_callback)
63 if (do_callback)
65 // Scheduling ourselves for doing the callbacks
66 if (TAO_debug_level > 0)
67 ACE_DEBUG ((LM_DEBUG,
68 ACE_TEXT ("Scheduling for callback\n")));
70 if (this->orb_->orb_core ()->reactor ()->schedule_timer (this,
72 ACE_Time_Value (1)) == -1)
74 ACE_ERROR ((LM_ERROR,
75 "(%P|%t) Can't schedule timers, aborting ..\n"));
77 ACE_OS::abort ();
81 return 0;
84 void
85 Simple_Server_i::callback_object (Callback_ptr callback
88 // Store the callback object
89 this->callback_ = Callback::_duplicate (callback);
93 void
94 Simple_Server_i::shutdown ()
96 this->orb_->shutdown (false);