blob: a2f0451bd10c75a5c7f6fd4c2ba62dbf74378e69 (
plain)
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
|
// -*- C++ -*-
#include "test_i.h"
#include "tao/PortableServer/ForwardRequestC.h"
test_i::test_i (CORBA::Short id,
bool direct,
CORBA::ORB_ptr orb)
: id_ (id)
, direct_ (direct)
, orb_ (CORBA::ORB::_duplicate (orb))
, to_ (CORBA::Object::_nil ())
, request_pass_count_ (0)
, request_count_ (0)
{
}
void
test_i::forward (CORBA::Object_ptr to,
CORBA::ULong request_pass_count)
{
this->to_ = CORBA::Object::_duplicate (to);
this->request_pass_count_ = request_pass_count;
}
CORBA::Short
test_i::collocated_call (void)
{
this->request_count_++;
ACE_DEBUG ((LM_DEBUG,
"Collocated call is executed in object with id %d.\n",
this->id_));
if (!CORBA::is_nil (this->to_.in ()))
{
if (this->request_count_ == this->request_pass_count_)
{
ACE_DEBUG ((LM_DEBUG,
"SERVER: Request %d will be forwarded "
"to object 'to'\nSERVER: via collocated_call().\n",
this->request_count_));
// Throw forward exception
throw PortableServer::ForwardRequest (this->to_.in ());
}
}
return this->id_;
}
|