Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / Faults / test_i.cpp
blob449e6db1780d1689defb85da556b12abe8087919
1 #include "test_i.h"
3 #if !defined(__ACE_INLINE__)
4 #include "test_i.inl"
5 #endif /* __ACE_INLINE__ */
7 #include "ace/OS_NS_unistd.h"
9 void
10 Callback_i::shutdown (CORBA::Boolean is_clean)
12 if (is_clean == 0)
14 ACE_DEBUG ((LM_DEBUG, "Performing catastrophic shutdown\n"));
16 // OpenVMS seems to hang and not abort and dump core when abort() is called
17 // here. This needs further investigation.
18 #if defined (DEC_CXX) || defined (ACE_OPENVMS)
19 ACE_OS::_exit();
20 #else
21 ACE_OS::abort();
22 #endif
23 return;
25 this->orb_->shutdown (0);
27 ACE_DEBUG ((LM_DEBUG, "Shutdown: Performed clean shutdown\n"));
30 // ****************************************************************
32 CORBA::Long
33 Simple_Server_i::test_method (CORBA::Boolean do_callback,
34 CORBA::Boolean is_clean,
35 Callback_ptr callback)
37 if (do_callback)
39 ACE_DEBUG ((LM_DEBUG, "Callback to shutdown client (%d)\n",
40 is_clean));
41 callback->shutdown (is_clean);
43 ACE_Time_Value tv (0, 20000);
44 ACE_OS::sleep (tv);
45 return 0;
48 void
49 Simple_Server_i::shutdown_now (CORBA::Boolean is_clean)
51 if (is_clean == 0)
53 ACE_DEBUG ((LM_DEBUG, "Performing catastrophic shutdown\n"));
54 #if defined (DEC_CXX) || defined (ACE_OPENVMS)
55 ACE_OS::_exit();
56 #else
57 ACE_OS::abort();
58 #endif
59 return;
62 ACE_DEBUG ((LM_DEBUG, "shutdown_now:Performing clean shutdown\n"));
63 this->orb_->shutdown (0);
66 void
67 Simple_Server_i::shutdown (void)
69 this->orb_->shutdown (0);
72 // ****************************************************************
74 CORBA::Long
75 Middle_i::test_method (CORBA::Boolean do_callback,
76 CORBA::Boolean is_clean,
77 Callback_ptr callback)
79 int i = 0;
80 for (; i != 10; ++i)
82 this->server_->test_method (0,
84 callback);
87 this->server_->test_method (do_callback,
88 is_clean,
89 callback);
91 for (; i != 10; ++i)
93 this->server_->test_method (0,
95 callback);
98 return 0;
101 void
102 Middle_i::shutdown_now (CORBA::Boolean is_clean)
104 this->server_->shutdown_now (is_clean);
107 void
108 Middle_i::shutdown (void)
112 this->server_->shutdown ();
114 catch (const CORBA::Exception&)
116 // ignore them
119 this->orb_->shutdown (0);