1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
|
#include "Invocation_Base.h"
#include "Stub.h"
#include "operation_details.h"
#include "ORB_Core.h"
#include "SystemException.h"
#include "PortableInterceptor.h" /* Must always be visible. */
#include "ace/Dynamic_Service.h"
#if TAO_HAS_INTERCEPTORS == 1
# include "PortableInterceptorC.h"
# include "ClientRequestInterceptor_Adapter_Factory.h"
#endif /* TAO_HAS_INTERCEPTORS == 1*/
#if !defined (__ACE_INLINE__)
# include "Invocation_Base.inl"
#endif /* __ACE_INLINE__ */
ACE_RCSID (tao,
Invocation_Base,
"$Id$")
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
namespace TAO
{
Invocation_Base::Invocation_Base (CORBA::Object_ptr ot,
CORBA::Object_ptr t,
TAO_Stub *stub,
TAO_Operation_Details &details,
bool response_expected)
: details_ (details)
, forwarded_to_ (0)
, response_expected_ (response_expected)
, otarget_ (ot)
, target_ (t)
, orb_core_ (stub->orb_core ())
, stub_ (stub)
#if TAO_HAS_INTERCEPTORS == 1
, adapter_ (orb_core_->clientrequestinterceptor_adapter ())
, stack_size_ (0)
, invoke_status_ (TAO_INVOKE_START)
, caught_exception_ (0)
#endif /*TAO_HAS_INTERCEPTORS == 1*/
{
}
Invocation_Base::~Invocation_Base (void)
{
#if TAO_HAS_INTERCEPTORS == 1
adapter_ = 0;
#endif /*TAO_HAS_INTERCEPTORS == 1*/
}
void
Invocation_Base::reply_received (Invocation_Status TAO_INTERCEPTOR (s))
{
TAO_INTERCEPTOR (invoke_status_ = s);
}
TAO_Service_Context &
Invocation_Base::request_service_context (void)
{
return this->details_.request_service_context ();
}
TAO_Service_Context &
Invocation_Base::reply_service_context (void)
{
return this->details_.reply_service_context ();
}
#if TAO_HAS_INTERCEPTORS == 1
Invocation_Status
Invocation_Base::send_request_interception (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
if (adapter_ != 0)
{
ACE_TRY
{
this->adapter_->send_request (*this
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
}
ACE_CATCHANY
{
(void) this->handle_any_exception (&ACE_ANY_EXCEPTION
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
// This is a begin interception point
ACE_RE_THROW;
}
# if defined (ACE_HAS_EXCEPTIONS) \
&& defined (ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS)
ACE_CATCHALL
{
(void) this->handle_all_exception (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
// This is a begin interception point
ACE_RE_THROW;
}
# endif /* ACE_HAS_EXCEPTIONS && ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS */
ACE_ENDTRY;
ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
if (this->forwarded_to_.in ())
return TAO_INVOKE_RESTART;
}
// What are the other cases??
return TAO_INVOKE_SUCCESS;
}
Invocation_Status
Invocation_Base::receive_reply_interception (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
if (adapter_ != 0)
{
ACE_TRY
{
this->adapter_->receive_reply (*this
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
}
ACE_CATCHANY
{
(void) this->handle_any_exception (&ACE_ANY_EXCEPTION
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
ACE_RE_THROW;
}
# if defined (ACE_HAS_EXCEPTIONS) \
&& defined (ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS)
ACE_CATCHALL
{
(void) this->handle_all_exception (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
ACE_RE_THROW;
}
# endif /* ACE_HAS_EXCEPTIONS && ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS */
ACE_ENDTRY;
ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
const PortableInterceptor::ReplyStatus status =
this->adapter_->reply_status (*this);
if (status == PortableInterceptor::LOCATION_FORWARD ||
status == PortableInterceptor::TRANSPORT_RETRY)
return TAO_INVOKE_RESTART;
}
return TAO_INVOKE_SUCCESS;
}
Invocation_Status
Invocation_Base::receive_other_interception (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
if (adapter_ != 0)
{
ACE_TRY
{
this->adapter_->receive_other (*this
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
}
ACE_CATCHANY
{
(void) this->handle_any_exception (&ACE_ANY_EXCEPTION
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
ACE_RE_THROW;
}
# if defined (ACE_HAS_EXCEPTIONS) \
&& defined (ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS)
ACE_CATCHALL
{
(void) this->handle_all_exception (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
ACE_RE_THROW;
}
# endif /* ACE_HAS_EXCEPTIONS && ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS */
ACE_ENDTRY;
ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
if (this->forwarded_to_.in ())
return TAO_INVOKE_RESTART;
}
return TAO_INVOKE_SUCCESS;
}
PortableInterceptor::ReplyStatus
Invocation_Base::handle_any_exception (CORBA::Exception *ex
ACE_ENV_ARG_DECL)
{
this->exception (ex);
PortableInterceptor::ReplyStatus status =
PortableInterceptor::SYSTEM_EXCEPTION;
if (adapter_ != 0)
{
this->adapter_->receive_exception (*this
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (PortableInterceptor::UNKNOWN);
status =
this->adapter_->reply_status (*this);
}
return status;
}
PortableInterceptor::ReplyStatus
Invocation_Base::handle_all_exception (ACE_ENV_SINGLE_ARG_DECL)
{
CORBA::UNKNOWN ex;
this->exception (&ex);
PortableInterceptor::ReplyStatus status =
PortableInterceptor::SYSTEM_EXCEPTION;
if (adapter_ != 0)
{
this->adapter_->receive_exception (*this
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (PortableInterceptor::UNKNOWN);
status =
this->adapter_->reply_status (*this);
}
return status;
}
void
Invocation_Base::exception (CORBA::Exception *exception)
{
if (CORBA::SystemException::_downcast (exception) != 0)
this->invoke_status_ = TAO::TAO_INVOKE_SYSTEM_EXCEPTION;
else if (CORBA::UserException::_downcast (exception) != 0)
this->invoke_status_ = TAO::TAO_INVOKE_USER_EXCEPTION;
this->caught_exception_ = exception;
}
PortableInterceptor::ReplyStatus
Invocation_Base::reply_status (void) const
{
if (adapter_ != 0)
{
return this->adapter_->reply_status (*this);
}
else
{
return -1;
}
}
#endif /*TAO_HAS_INTERCEPTORS == 1*/
}
TAO_END_VERSIONED_NAMESPACE_DECL
|