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
76
77
78
79
80
81
82
83
84
85
86
87
88
|
//
// $Id$
//
#include "Empty.h"
ACE_RCSID(Multiple_Deactivations, Empty, "$Id$")
CORBA::ULong Empty::in_request_count_ = 0;
Empty::Empty (void)
: refcnt_ (1)
{
}
Empty::~Empty (void)
{
if (this->refcnt_ != 0)
{
ACE_ERROR ((LM_ERROR,
"ERROR: Empty::~Empty ref count is not 0\n"));
}
if (Empty::in_request_count_ != 0)
{
ACE_ERROR ((LM_ERROR,
"ERROR: Empty::~Empty invoked while in a request\n"));
}
}
void
Empty::_add_ref (CORBA::Environment &)
ACE_THROW_SPEC (())
{
ACE_DEBUG ((LM_DEBUG, "Empty::_add_ref\n"));
this->refcnt_++;
}
void
Empty::_remove_ref (CORBA::Environment &)
ACE_THROW_SPEC (())
{
ACE_DEBUG ((LM_DEBUG, "Empty::_remove_ref\n"));
if (this->refcnt_ == 0)
{
ACE_ERROR ((LM_ERROR, "ERROR: ref count is 0\n"));
return;
}
--this->refcnt_;
if (this->refcnt_ == 0)
delete this;
}
void
Empty::destroy (CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
{
ACE_DEBUG ((LM_DEBUG, "Empty::_destroy\n"));
Empty::in_request_count_++;
ACE_TRY
{
PortableServer::POA_var poa =
this->_default_POA (ACE_TRY_ENV);
ACE_TRY_CHECK;
PortableServer::ObjectId_var id =
poa->servant_to_id (this, ACE_TRY_ENV);
ACE_TRY_CHECK;
ACE_DEBUG ((LM_DEBUG, "Empty::_destroy, deactivate[1]\n"));
poa->deactivate_object (id.in (), ACE_TRY_ENV);
ACE_TRY_CHECK;
ACE_DEBUG ((LM_DEBUG, "Empty::_destroy, deactivate[2]\n"));
poa->deactivate_object (id.in (), ACE_TRY_ENV);
ACE_TRY_CHECK;
ACE_DEBUG ((LM_DEBUG, "Empty::_destroy, deactivate[3]\n"));
poa->deactivate_object (id.in (), ACE_TRY_ENV);
ACE_TRY_CHECK;
}
ACE_CATCHANY
{
ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
"Empty::destroy - exception caught:");
}
ACE_ENDTRY;
Empty::in_request_count_--;
}
|