1 #include "client_interceptor.h"
3 #include "ace/Log_Msg.h"
5 extern const ACE_TCHAR
*server2_ior
;
6 extern CORBA::ORB_var orb
;
8 const IOP::ServiceId service_id
= 0xdeadbeef;
11 extern Demo::HelloWorld_var server1_shutdownObj
;
13 Echo_Client_Request_Interceptor::
14 Echo_Client_Request_Interceptor ()
15 : myname_ ("Echo_Client_Interceptor")
19 Echo_Client_Request_Interceptor::~Echo_Client_Request_Interceptor (void)
24 Echo_Client_Request_Interceptor::name (void)
26 return CORBA::string_dup (this->myname_
);
30 Echo_Client_Request_Interceptor::destroy (void)
35 Echo_Client_Request_Interceptor::send_poll (
36 PortableInterceptor::ClientRequestInfo_ptr
)
42 Echo_Client_Request_Interceptor::send_request (
43 PortableInterceptor::ClientRequestInfo_ptr ri
)
45 CORBA::String_var operation
= ri
->operation ();
46 if (ACE_OS::strcmp (operation
.in (), "shutdown") == 0) {
52 if (isRecursive
%2 == 1 )
55 if (isRecursive
== 3) {
56 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT ("(%P|%t)Echo_Client_Request_Interceptor::send_request(%d) ")
57 ACE_TEXT ("shutdown server 1 now. \n"), isRecursive
));
58 server1_shutdownObj
->shutdown();
61 CORBA::Object_var helloObj
= orb
->string_to_object(server2_ior
);
63 Demo::HelloWorld_var hello
= Demo::HelloWorld::_narrow(helloObj
.in ());
65 if (CORBA::is_nil(hello
.in ())) {
66 ACE_ERROR ((LM_ERROR
, ACE_TEXT ("(%P|%t)Echo_Client_Request_Interceptor::send_request(%d) ")
67 ACE_TEXT ("hello reference is nil.\n"), isRecursive
));
70 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT ("(%P|%t)Echo_Client_Request_Interceptor::send_request(%d) ")
71 ACE_TEXT ("call server2 HelloWorld::sayHello() \n"), isRecursive
));
72 const char* pMsg
= " server2 say Hello";
73 hello
->sayHello(pMsg
) ;
79 Echo_Client_Request_Interceptor::receive_reply (
80 PortableInterceptor::ClientRequestInfo_ptr
)
85 Echo_Client_Request_Interceptor::receive_other (
86 PortableInterceptor::ClientRequestInfo_ptr
)
91 Echo_Client_Request_Interceptor::receive_exception (
92 PortableInterceptor::ClientRequestInfo_ptr
)