blob: 4c592413169371dab19bb64a1859ef468be0fe36 (
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
62
63
64
65
66
67
68
69
70
|
#include "AMI_Buffering.h"
AMI_Buffering::AMI_Buffering (CORBA::ORB_ptr orb,
Test::AMI_Buffering_Admin_ptr admin)
: orb_ (CORBA::ORB::_duplicate (orb)),
admin_ (Test::AMI_Buffering_Admin::_duplicate (admin)),
nest_ (0),
max_nest_ (0),
must_shutdown_ (false)
{
}
AMI_Buffering::Nest_Guard::Nest_Guard (AMI_Buffering &a)
:target_(a)
{
++target_.nest_;
if (target_.nest_ > target_.max_nest_)
target_.max_nest_ = target_.nest_;
}
AMI_Buffering::Nest_Guard::~Nest_Guard (void)
{
--target_.nest_;
}
void
AMI_Buffering::receive_data (const Test::Payload &the_payload)
{
try
{
AMI_Buffering::Nest_Guard ng(*this);
this->admin_->request_received (the_payload.length ());
}
catch (const CORBA::Exception&)
{
ACE_DEBUG ((LM_DEBUG,"(%P|%t) DEBUG: AMI_Buffering::receive_data"));
}
this->try_shutdown();
}
void
AMI_Buffering::flush (void)
{
}
void
AMI_Buffering::sync (void)
{
this->admin_->flush ();
}
void
AMI_Buffering::shutdown (void)
{
this->must_shutdown_ = true;
this->try_shutdown();
}
void
AMI_Buffering::try_shutdown(void)
{
if (!this->must_shutdown_ || this->nest_ > 0)
return;
if (this->max_nest_ > 1)
ACE_DEBUG ((LM_DEBUG, "(%P|%t) max nesting level: %d\n", max_nest_));
this->admin_->shutdown();
this->orb_->shutdown (false);
}
|