1 #include "client_interceptor.h"
3 #include "ace/Log_Msg.h"
5 extern const ACE_TCHAR
*server2_ior
;
6 extern CORBA::ORB_var orb
;
9 extern Demo::HelloWorld_var server1_shutdownObj
;
11 Echo_Client_Request_Interceptor::
12 Echo_Client_Request_Interceptor ()
13 : myname_ ("Echo_Client_Interceptor")
18 Echo_Client_Request_Interceptor::name ()
20 return CORBA::string_dup (this->myname_
);
24 Echo_Client_Request_Interceptor::destroy ()
29 Echo_Client_Request_Interceptor::send_poll (
30 PortableInterceptor::ClientRequestInfo_ptr
)
36 Echo_Client_Request_Interceptor::send_request (
37 PortableInterceptor::ClientRequestInfo_ptr ri
)
39 CORBA::String_var operation
= ri
->operation ();
40 if (ACE_OS::strcmp (operation
.in (), "shutdown") == 0) {
46 if (isRecursive
%2 == 1 )
48 if (isRecursive
== 3) {
49 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT ("(%P|%t)Echo_Client_Request_Interceptor::send_request(%d) ")
50 ACE_TEXT ("shutdown server 1 now. \n"), isRecursive
));
51 server1_shutdownObj
->shutdown();
54 CORBA::Object_var helloObj
= orb
->string_to_object(server2_ior
);
56 Demo::HelloWorld_var hello
= Demo::HelloWorld::_narrow(helloObj
.in ());
58 if (CORBA::is_nil(hello
.in ())) {
59 ACE_ERROR ((LM_ERROR
, ACE_TEXT ("(%P|%t)Echo_Client_Request_Interceptor::send_request(%d) ")
60 ACE_TEXT ("hello reference is nil.\n"), isRecursive
));
63 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT ("(%P|%t)Echo_Client_Request_Interceptor::send_request(%d) ")
64 ACE_TEXT ("call server2 HelloWorld::sayHello() \n"), isRecursive
));
65 const char* pMsg
= " server2 say Hello";
66 hello
->sayHello(pMsg
);
72 Echo_Client_Request_Interceptor::receive_reply (
73 PortableInterceptor::ClientRequestInfo_ptr
)
78 Echo_Client_Request_Interceptor::receive_other (
79 PortableInterceptor::ClientRequestInfo_ptr
)
84 Echo_Client_Request_Interceptor::receive_exception (
85 PortableInterceptor::ClientRequestInfo_ptr
)