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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
|
//$Id$
#include "tao/AnyTypeCode/TypeCode.h"
#include "tao/AnyTypeCode/AnyTypeCode_methods.h"
#include "tao/DynamicInterface/DII_Invocation_Adapter.h"
#include "tao/DynamicInterface/DII_Invocation.h"
#include "tao/DynamicInterface/DII_Reply_Dispatcher.h"
#include "tao/DynamicInterface/DII_Arguments_Converter_Impl.h"
#include "tao/DynamicInterface/Request.h"
#include "tao/Exception.h"
#include "tao/Exception_Data.h"
#include "tao/ORB_Constants.h"
#include "tao/Profile_Transport_Resolver.h"
#include "tao/Transport.h"
#include "tao/GIOP_Message_Base.h"
#include "tao/SystemException.h"
#include "tao/operation_details.h"
#include "ace/os_include/os_errno.h"
ACE_RCSID (DynamicInterface,
DII_Invocation_Adapter,
"$Id$")
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
namespace TAO
{
DII_Invocation_Adapter::DII_Invocation_Adapter (CORBA::Object *target,
Argument **args,
int arg_number,
const char *operation,
size_t op_len,
CORBA::ExceptionList *excp,
CORBA::Request *r,
Invocation_Mode mode)
: Invocation_Adapter (target,
args,
arg_number,
operation,
op_len,
0, // Collocation Proxy broker pointer
TAO_TWOWAY_INVOCATION,
mode)
, exception_list_ (excp)
, request_ (r)
, ex_data_ (0)
{
}
DII_Invocation_Adapter::~DII_Invocation_Adapter (void)
{
delete[] ex_data_;
}
void
DII_Invocation_Adapter::invoke (TAO::Exception_Data * /*ex_data*/,
unsigned long ex_count)
{
// Convert DII exception list to a form the invocation can use
// to filter raised user exceptions.
ex_count = this->exception_list_->count ();
ACE_NEW_THROW_EX (this->ex_data_,
TAO::Exception_Data[ex_count],
CORBA::NO_MEMORY ());
for (unsigned long l=0; l<ex_count ;++l)
{
CORBA::TypeCode_var xtc = this->exception_list_->item (l);
this->ex_data_[l].id = xtc->id ();
this->ex_data_[l].alloc = 0;
#if TAO_HAS_INTERCEPTORS == 1
this->ex_data_[l].tc_ptr = xtc.in ();
#endif
}
Invocation_Adapter::invoke (this->ex_data_, ex_count);
}
Invocation_Status
DII_Invocation_Adapter::invoke_collocated_i (
TAO_Stub *stub,
TAO_Operation_Details &details,
CORBA::Object_var &effective_target,
Collocation_Strategy strat)
{
TAO_DII_Arguments_Converter_Impl* dii_arguments_converter
= ACE_Dynamic_Service<TAO_DII_Arguments_Converter_Impl>::instance (
"DII_Arguments_Converter");
details.cac (dii_arguments_converter);
return Invocation_Adapter::invoke_collocated_i (stub,
details,
effective_target,
strat);
}
Invocation_Status
DII_Invocation_Adapter::invoke_twoway (
TAO_Operation_Details &op,
CORBA::Object_var &effective_target,
Profile_Transport_Resolver &r,
ACE_Time_Value *&max_wait_time)
{
// Simple sanity check
if (this->mode_ != TAO_DII_INVOCATION ||
this->type_ != TAO_TWOWAY_INVOCATION)
{
throw ::CORBA::INTERNAL (
CORBA::SystemException::_tao_minor_code (
TAO::VMCID,
EINVAL),
CORBA::COMPLETED_NO);
}
TAO_Transport* const transport = r.transport ();
if (!transport)
{
// Way back, we failed to find a profile we could connect to.
// We've come this far only so we reach the interception points
// in case they can fix things. Time to bail....
throw CORBA::TRANSIENT (CORBA::OMGVMCID | 2, CORBA::COMPLETED_NO);
}
ACE_GUARD_RETURN (ACE_Lock, ace_mon, *transport->output_cdr_lock ()
, TAO_INVOKE_FAILURE);
transport->messaging_object ()->out_stream ().reset_byte_order (
request_->_tao_byte_order ());
TAO::DII_Invocation synch (this->target_,
r,
op,
this->exception_list_,
this->request_);
ace_mon.release();
Invocation_Status status = synch.remote_invocation (max_wait_time);
if (status == TAO_INVOKE_RESTART &&
(synch.reply_status () == GIOP::LOCATION_FORWARD ||
synch.reply_status () == GIOP::LOCATION_FORWARD_PERM))
{
CORBA::Boolean const permanent_forward =
(synch.reply_status () == GIOP::LOCATION_FORWARD_PERM);
effective_target = synch.steal_forwarded_reference ();
this->object_forwarded (effective_target,
r.stub (),
permanent_forward);
}
return status;
}
//================================================================
DII_Deferred_Invocation_Adapter::DII_Deferred_Invocation_Adapter (
CORBA::Object *target,
Argument **args,
int arg_number,
const char *operation,
size_t op_len,
Collocation_Proxy_Broker *b,
TAO_ORB_Core *oc,
CORBA::Request *req,
Invocation_Mode mode)
: Invocation_Adapter (target,
args,
arg_number,
operation,
op_len,
b,
TAO_TWOWAY_INVOCATION,
mode)
, request_ (req)
, rd_ (0)
, orb_core_ (oc)
{
}
void
DII_Deferred_Invocation_Adapter::invoke (
TAO::Exception_Data *ex,
unsigned long ex_count)
{
// New reply dispatcher on the heap, because we will go out of
// scope and hand over the reply dispatcher to the ORB.
// So this->rd_ is 0, because we do not need to
// hold a pointer to it.
ACE_NEW_THROW_EX (this->rd_,
TAO_DII_Deferred_Reply_Dispatcher (this->request_,
this->orb_core_),
CORBA::NO_MEMORY ());
Invocation_Adapter::invoke (ex, ex_count);
}
Invocation_Status
DII_Deferred_Invocation_Adapter::invoke_collocated_i (
TAO_Stub *stub,
TAO_Operation_Details &details,
CORBA::Object_var &effective_target,
Collocation_Strategy strat)
{
TAO_DII_Arguments_Converter_Impl* dii_arguments_converter
= ACE_Dynamic_Service<TAO_DII_Arguments_Converter_Impl>::instance (
"DII_Arguments_Converter");
details.cac (dii_arguments_converter);
return Invocation_Adapter::invoke_collocated_i (stub,
details,
effective_target,
strat);
}
Invocation_Status
DII_Deferred_Invocation_Adapter::invoke_twoway (
TAO_Operation_Details &op,
CORBA::Object_var &effective_target,
Profile_Transport_Resolver &r,
ACE_Time_Value *&max_wait_time)
{
// Simple sanity check
if (this->mode_ != TAO_DII_DEFERRED_INVOCATION ||
this->type_ != TAO_TWOWAY_INVOCATION)
{
throw ::CORBA::INTERNAL (
CORBA::SystemException::_tao_minor_code (
TAO::VMCID,
EINVAL),
CORBA::COMPLETED_NO);
}
TAO_Transport* const transport = r.transport ();
if (!transport)
{
// Way back, we failed to find a profile we could connect to.
// We've come this far only so we reach the interception points
// in case they can fix things. Time to bail....
throw CORBA::TRANSIENT (CORBA::OMGVMCID | 2, CORBA::COMPLETED_NO);
}
transport->messaging_object ()->out_stream ().reset_byte_order (
request_->_tao_byte_order ());
TAO::DII_Deferred_Invocation synch (
this->target_,
r,
op,
this->rd_,
this->request_);
Invocation_Status status = synch.remote_invocation (max_wait_time);
if (status == TAO_INVOKE_RESTART)
{
effective_target = synch.steal_forwarded_reference ();
}
return status;
}
DII_Asynch_Invocation_Adapter::DII_Asynch_Invocation_Adapter (
CORBA::Object *target,
Argument **args,
int arg_count,
const char *operation,
int op_len,
CORBA::Request *req,
TAO::Invocation_Mode mode)
: DII_Invocation_Adapter (target,
args,
arg_count,
operation,
op_len,
0,
req,
mode)
{
}
Invocation_Status
DII_Asynch_Invocation_Adapter::invoke_twoway (
TAO_Operation_Details &,
CORBA::Object_var &,
Profile_Transport_Resolver &,
ACE_Time_Value *&)
{
return TAO_INVOKE_FAILURE;
}
DII_Oneway_Invocation_Adapter::DII_Oneway_Invocation_Adapter (
CORBA::Object *target,
Argument **args,
int arg_count,
const char *operation,
int op_len,
TAO::Invocation_Mode mode)
: Invocation_Adapter (target,
args,
arg_count,
operation,
op_len,
0,
TAO_ONEWAY_INVOCATION,
mode)
{
}
Invocation_Status
DII_Oneway_Invocation_Adapter::invoke_collocated_i (
TAO_Stub *stub,
TAO_Operation_Details &details,
CORBA::Object_var &effective_target,
Collocation_Strategy strat)
{
TAO_DII_Arguments_Converter_Impl* dii_arguments_converter
= ACE_Dynamic_Service<TAO_DII_Arguments_Converter_Impl>::instance (
"DII_Arguments_Converter");
details.cac (dii_arguments_converter);
return Invocation_Adapter::invoke_collocated_i (stub,
details,
effective_target,
strat);
}
} // End namespace TAO
TAO_END_VERSIONED_NAMESPACE_DECL
|