2 #include "Client_Request_Interceptor.h"
5 #include "ace/Log_Msg.h"
7 Client_Request_Interceptor::Client_Request_Interceptor (
9 const char *forward_str
)
10 : orb_id_ (CORBA::string_dup (orb_id
)),
13 forward_str_ (CORBA::string_dup (forward_str
))
18 Client_Request_Interceptor::name ()
20 return CORBA::string_dup ("Client_Request_Interceptor");
24 Client_Request_Interceptor::destroy ()
29 Client_Request_Interceptor::send_request (
30 PortableInterceptor::ClientRequestInfo_ptr ri
)
33 ACE_TEXT ("CRI: in send_request\n")));
35 ++this->request_count_
;
37 CORBA::Boolean response_expected
=
38 ri
->response_expected ();
40 if (!response_expected
) // A one-way request.
43 // Request 1 -- non-forwarded
44 // Request 2 -- forwarded by this interception point.
45 // Request 3 -- non-forwarded
47 if (this->request_count_
== 2)
49 if (CORBA::is_nil (this->orb_
.in ()))
53 this->orb_
= CORBA::ORB_init (argc
,
58 CORBA::Object_var forward
=
59 this->orb_
->string_to_object (this->forward_str_
.in ());
61 CORBA::String_var forward_str
=
62 this->orb_
->object_to_string (forward
.in ());
65 ACE_TEXT ("CRI: request %d will be forwarded via send_request()\n"),
66 this->request_count_
));
68 // Notice that this is not a permanent forward.
69 throw PortableInterceptor::ForwardRequest (forward
.in ());
74 Client_Request_Interceptor::send_poll (
75 PortableInterceptor::ClientRequestInfo_ptr
)
78 ACE_TEXT ("CRI: in send_poll\n")));
82 Client_Request_Interceptor::receive_reply (
83 PortableInterceptor::ClientRequestInfo_ptr
)
86 ACE_TEXT ("CRI: in receive_reply\n")));
90 Client_Request_Interceptor::receive_exception (
91 PortableInterceptor::ClientRequestInfo_ptr
)
94 ACE_TEXT ("CRI: in receive_exception\n")));
98 Client_Request_Interceptor::receive_other (
99 PortableInterceptor::ClientRequestInfo_ptr ri
)
101 ACE_DEBUG ((LM_DEBUG
,
102 ACE_TEXT ("CRI: in receive_other\n")));
104 CORBA::Boolean response_expected
=
105 ri
->response_expected ();
108 if (!response_expected
)
111 PortableInterceptor::ReplyStatus reply_status
;
115 ACE_DEBUG ((LM_DEBUG
,
116 ACE_TEXT ("CRI: in receive_other, before reply_status\n")));
118 reply_status
= ri
->reply_status ();
119 ACE_UNUSED_ARG (reply_status
);
121 catch(CORBA::BAD_INV_ORDER
const &e
)
123 e
._tao_print_exception ("CRI: exception");
126 ACE_DEBUG ((LM_DEBUG
,
127 ACE_TEXT ("CRI: in receive_other, after reply_status\n")));