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
|
//
// $Id$
//
#include "Session_Control.h"
ACE_RCSID(Big_Oneways, Session_Control, "$Id$")
Session_Control::Session_Control (CORBA::ULong session_count)
: session_count_ (session_count)
, success_ (1)
{
}
int
Session_Control::all_sessions_finished (void) const
{
return this->session_count_ == 0;
}
Session_Control::~Session_Control (void)
{
if (this->session_count_ == 0 && this->success_)
{
ACE_DEBUG ((LM_DEBUG,
"(%P|%t) Session_Control::~Session_control, "
" good, all sessions did finish\n"));
}
else if (session_count_ != 0)
{
ACE_ERROR ((LM_ERROR,
"ERROR: (%P|%t) Session_Control::~Session_control, "
" %d sessions did not finish\n",
this->session_count_));
}
else
{
ACE_ERROR ((LM_ERROR,
"ERROR: (%P|%t) Session_Control::~Session_control, "
" some sessions failed\n"));
}
}
void
Session_Control::session_finished (CORBA::Boolean success
TAO_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->mutex_);
if (this->session_count_ == 0)
{
ACE_ERROR ((LM_ERROR,
"ERROR: (%P|%t) Session_Control::session_finished, "
"unexpected callback\n"));
}
if (success == 0)
this->success_ = 0;
this->session_count_--;
ACE_DEBUG ((LM_DEBUG,
"(%P|%t) Session_Control::session_finished, "
"%d sessions to go\n",
this->session_count_));
if (session_count_ == 0)
{
PortableServer::POA_var poa =
this->_default_POA (TAO_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK;
PortableServer::ObjectId_var oid =
poa->servant_to_id (this TAO_ENV_ARG_PARAMETER);
ACE_CHECK;
poa->deactivate_object (oid.in () TAO_ENV_ARG_PARAMETER);
ACE_CHECK;
}
}
|