Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / DevGuideExamples / BiDirectionalGIOP / simple_i.cpp
blob32aafb0e039e8dd2212c1520af0dc6f86052d703
1 #include "bidir_giop_pch.h"
3 #include "simple_i.h"
5 #include "tao/ORB_Core.h"
6 #include "tao/Transport_Cache_Manager.h"
7 #include "tao/Thread_Lane_Resources.h"
9 #include <iostream>
11 Simple_i::Simple_i (CORBA::ORB_ptr orb, int callback_count)
12 : orb_(CORBA::ORB::_duplicate(orb))
13 , ready_for_callback_(0)
14 , callback_count_(callback_count)
15 , callback_(0)
19 CORBA::Long Simple_i::test_method (CORBA::Boolean do_callback)
21 if (do_callback) {
22 ready_for_callback_ = 1;
24 return 0;
27 void Simple_i::callback_object (Callback_ptr cb)
29 callback_ = Callback::_duplicate(cb);
32 void Simple_i::shutdown ()
34 CORBA::Boolean wait = false;
35 orb_->shutdown(wait);
38 int
39 Simple_i::call_client()
41 if (ready_for_callback_) {
42 ready_for_callback_ = 0;
44 for (int times = 0; times < callback_count_; ++times) {
45 callback_->callback_method();
47 if (orb_->orb_core()->lane_resources().transport_cache().current_size() > 1)
49 std::cerr << "The connection cache has grown. "
50 << "BiDirection did not work. aborting..." << std::endl;
51 ACE_OS::abort(); // Should probably define and throw a UserException
55 callback_->shutdown();
57 return 1;
60 return 0;