Continued changes from peer review
[ACE_TAO.git] / TAO / tests / Collocated_Forwarding / test_i.cpp
bloba2f0451bd10c75a5c7f6fd4c2ba62dbf74378e69
1 // -*- C++ -*-
3 #include "test_i.h"
4 #include "tao/PortableServer/ForwardRequestC.h"
6 test_i::test_i (CORBA::Short id,
7 bool direct,
8 CORBA::ORB_ptr orb)
9 : id_ (id)
10 , direct_ (direct)
11 , orb_ (CORBA::ORB::_duplicate (orb))
12 , to_ (CORBA::Object::_nil ())
13 , request_pass_count_ (0)
14 , request_count_ (0)
18 void
19 test_i::forward (CORBA::Object_ptr to,
20 CORBA::ULong request_pass_count)
22 this->to_ = CORBA::Object::_duplicate (to);
23 this->request_pass_count_ = request_pass_count;
26 CORBA::Short
27 test_i::collocated_call (void)
29 this->request_count_++;
31 ACE_DEBUG ((LM_DEBUG,
32 "Collocated call is executed in object with id %d.\n",
33 this->id_));
35 if (!CORBA::is_nil (this->to_.in ()))
37 if (this->request_count_ == this->request_pass_count_)
39 ACE_DEBUG ((LM_DEBUG,
40 "SERVER: Request %d will be forwarded "
41 "to object 'to'\nSERVER: via collocated_call().\n",
42 this->request_count_));
44 // Throw forward exception
45 throw PortableServer::ForwardRequest (this->to_.in ());
49 return this->id_;