blob: 38df305afdbb24a51ee17e3527bd9e205cb619bc (
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
71
72
73
74
75
76
77
78
79
|
//=============================================================================
/**
* @file POA_Destruction.cpp
*
* $Id$
*
* This program tests the destruction of a POA while there is an
* upcall in progress.
*
*
* @author Irfan Pyarali
*/
//=============================================================================
#include "testS.h"
class test_i : public POA_test
{
public:
void destroy_poa (void);
};
void
test_i::destroy_poa (void)
{
PortableServer::POA_var poa = this->_default_POA ();
CORBA::Boolean etherealize_objects = 1;
CORBA::Boolean wait_for_completion = 0;
poa->destroy (etherealize_objects,
wait_for_completion);
}
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
try
{
// Initialize the ORB first.
CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
// Obtain the RootPOA.
CORBA::Object_var obj =
orb->resolve_initial_references ("RootPOA");
// Get the POA_var object from Object_var.
PortableServer::POA_var root_poa =
PortableServer::POA::_narrow (obj.in ());
// Get the POAManager of the RootPOA.
PortableServer::POAManager_var poa_manager =
root_poa->the_POAManager ();
poa_manager->activate ();
test_i servant;
PortableServer::ObjectId_var id =
root_poa->activate_object (&servant);
CORBA::Object_var object_act = root_poa->id_to_reference (id.in ());
test_var test_object = test::_narrow (object_act.in ());
test_object->destroy_poa ();
orb->destroy ();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("Exception caught");
return -1;
}
return 0;
}
|