1 #include "ClientRequestInterceptor.h"
2 #include "tao/CORBA_String.h"
3 #include "ace/Log_Msg.h"
4 #include "ace/OS_NS_string.h"
6 ClientRequestInterceptor::ClientRequestInterceptor (
7 PortableInterceptor::SlotId id
,
8 PortableInterceptor::Current_ptr pi_current
)
10 pi_current_ (PortableInterceptor::Current::_duplicate (pi_current
))
15 ClientRequestInterceptor::name ()
17 return CORBA::string_dup ("ClientRequestInterceptor");
21 ClientRequestInterceptor::destroy (void)
26 ClientRequestInterceptor::send_request (
27 PortableInterceptor::ClientRequestInfo_ptr ri
)
29 CORBA::String_var op
= ri
->operation ();
31 if (ACE_OS::strcmp (op
.in (), "invoke_me") != 0)
32 return; // Don't mess with PICurrent if not invoking test method.
36 // Retrieve data from the RSC (request scope current).
37 CORBA::Long number
= 0;
40 ri
->get_slot (this->slot_id_
);
42 if (!(data
.in () >>= number
))
45 "(%P|%t) ERROR: Unable to extract data from Any.\n"));
47 throw CORBA::INTERNAL ();
51 "(%P|%t) Extracted <%d> from RSC slot %u\n",
56 CORBA::String_var s
= CORBA::string_dup ("Et tu Brute?");
60 // Now reset the contents of our slot in the thread-scope
62 this->pi_current_
->set_slot (this->slot_id_
,
65 // Now retrieve the data from the RSC again. It should not have
67 CORBA::Long number2
= -1;
69 CORBA::Any_var data2
=
70 ri
->get_slot (this->slot_id_
);
72 if (!(data2
.in () >>= number2
)
76 "(%P|%t) ERROR: RSC was modified after "
77 "TSC was modified.\n"));
79 throw CORBA::INTERNAL ();
83 catch (const PortableInterceptor::InvalidSlot
& ex
)
85 ex
._tao_print_exception ("Exception thrown in ""send_request()\n");
91 throw CORBA::INTERNAL ();
95 "(%P|%t) Client side RSC/TSC semantics appear "
100 ClientRequestInterceptor::send_poll (
101 PortableInterceptor::ClientRequestInfo_ptr
)
106 ClientRequestInterceptor::receive_reply (
107 PortableInterceptor::ClientRequestInfo_ptr
)
112 ClientRequestInterceptor::receive_exception (
113 PortableInterceptor::ClientRequestInfo_ptr
)
118 ClientRequestInterceptor::receive_other (
119 PortableInterceptor::ClientRequestInfo_ptr
)