summaryrefslogtreecommitdiff
path: root/trunk/TAO/tests/Two_Objects/Second_i.cpp
blob: f7814901d3ddd6a7090af274f0dd2247246f0ce9 (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
51
52
53
54
55
56
57
58
59
60
61
// $Id$

#include "Second_i.h"
#include "tao/ORB_Core.h"
#include "tao/debug.h"
#include "tao/Transport_Cache_Manager.h"
#include "tao/Thread_Lane_Resources.h"
#include "ace/Auto_Event.h"


ACE_RCSID (Two_Objects,
           Second_i,
           "$Id$")


Second_i::Second_i (CORBA::ORB_ptr orb,
                    CORBA::ULong len, ACE_Auto_Event &two_way_done)
  : orb_ (CORBA::ORB::_duplicate (orb)),
    length_(len),
    two_way_done_(two_way_done)
{

}

Two_Objects_Test::Octet_Seq *
Second_i::twoway_method (void)
{
  Two_Objects_Test::Octet_Seq  *preply_mesg;

  ACE_NEW_THROW_EX (preply_mesg,
                    Two_Objects_Test::Octet_Seq (this->length_),
                    CORBA::NO_MEMORY ());

  Two_Objects_Test::Octet_Seq_var reply_var =
    preply_mesg;
  reply_var->length ( this->length_);

  ACE_DEBUG ((LM_DEBUG,
              "Twoway servant : (%P|%t) two way method called.\n"));

  // @@ This will not work with the latest copy of ACE+TAO :-). Irfan
  // has moved the cache somewhere else. You may want to check the
  // latest code in BiDir cals again ;)
  // @@ Try to use the current_size () instead of total_size ()
  ACE_ASSERT(this->orb_->orb_core ()->lane_resources().
               transport_cache ().current_size () == 1);

  ACE_DEBUG ((LM_DEBUG,
              "Twoway servant : (%P|%t) about to signal one way thread.\n"));

  two_way_done_.signal ();

  return reply_var._retn ();
}

void
Second_i::shutdown (void)
{
  ACE_DEBUG ((LM_DEBUG, "(%P|%t) about to shutdown the orb\n"));
  this->orb_->shutdown (0);
}