source: trunk/ORBit2-2.14.0/docs/internals/poa-notes.txt

Last change on this file was 92, checked in by cinc, 19 years ago

Orbit2 modified for use with NOM

File size: 5.8 KB
Line 
1 I'm just going to stick some stuff here to help anyone trying
2to hack the POA. I'll also try and keep it up to date ;)
3
4Mark.
5
6CORBA object and servant life cycles
7====================================
8
9 Here's a nice diagram from 'Advanced CORBA Porgamming with
10C++' by Henning and Vinoski.
11
12 +---------------------------+
13 | |
14 | Object Exists |
15 | |
16 | +------------------+ |
17 | | Object | |
18 | | Activated | |
19 | | +--------------+ | |
20 | | | Servant | | |
21 | | | Incarnated | | |
22 | | +--------------+ | |
23 | +------------------+ |
24 | ^ | |
25+--------------+ Creation | | | | Destruction +--------------+
26| Object |--------->| Activate Deactivate |------------>| Object |
27| Non-existent | | | | | | Non-existent |
28+--------------+ | | | | +--------------+
29 | | v |
30 | +------------------+ |
31 | | +--------------+ | |
32 | | | Servant | | |
33 | | | Etherealized | | |
34 | | +--------------+ | |
35 | | Object | |
36 | | Deactivated | |
37 | +------------------+ |
38 | |
39 +---------------------------+
40
41 The key points are :
42
43 * once an object reference has been created the object exists.
44 * once it exists it can either be activated or deactivated.
45 * to be activated it must be incarnated by a servant - i.e. a
46 servant must be associated with object.
47 * to be deactivated the servant must be etherealised - i.e.
48 the bond between the servant and object broken.
49 * activate and deacitvate apply to objects, incarnate and
50 etherealise apply to servants.
51
52ORBit's implementation
53======================
54
55 In ORBit and object reference is represented by a
56CORBA_Object and, within the POA, by a POAObject. Every CORBA_Object
57created by the POA has a POAObject associated with it.
58
59 When a POAObject is created it is entered into its POA's
60.oid_obj_map, a hash table with ObjectIds as keys and POAObjects as
61values.
62
63 When an object is activated by the POA, it is associated with
64a servant by setting its POAObject .servant member. The POAObject is
65also entered into a list of POAObjects in the servant's ._private
66member. The reverse is done when the object is deactivated.
67
68 The CORBA spec talks about an 'Active Object Map'. The idea is
69that if the POA has the RETAIN policy it stores the association
70between object id and servant in this Active Object Map when it is
71activated. In ORBit, there is no explicit Active Object Map. An object
72can be thought of being entered in the POA's Active Object Map once it has
73been entered in the POA's .oid_to_obj_map hash table (when the
74POAObject is created) and the POAOjbect's .servant is non-NULL (when
75the object is activated).
76
77POA refcounting
78===============
79
80 When talking about refcounting, I mean internal refs - i.e
81ORBit_RootOject_duplicate as opposed to CORBA_Object_duplicate - the
82application can also be responsible for refs to the POA.
83
84 * ORBit_POA_new - we're creating a POA, set the initial
85 refcount to 1. This ref is released in ORBit_POA_destroy.
86
87 * ORBit_POA_add_child - we're associating the POA with its
88 parent. The ref is released ORBit_POA_remove_child when the
89 POA is being destoryed.
90
91 * ORBit_POA_create_object - we're assoiciating a POA with a
92 POAObject. The ref is released in ORBit_POAObject_release_cb
93 when the POAObject is being destroyed.
94
95 * ORBit_init_internals - this is *only* for the RootPOA. We
96 don't want the RootPOA to be destroyed until, at the earliest,
97 the ORB has been destroyed. So, this ref is released in
98 CORBA_ORB_destroy.
99
100POAObject refcounting
101=====================
102
103 * ORBit_POA_activate_object - ref released in
104 ORBit_POA_deactivate.
105
106 * ORBit_POA_obj_to_ref - we're creating a CORBA_Object and
107 associating the POAObject with it. The ref is released in
108 CORBA_Object_release_cb when the object reference is being
109 destoryed.
110
111 * ORBit_POA_ServantManager_use_servant - we're using a servant
112 manager to activate an object. In both the RETAIN and
113 NON-RETAIN cases we ref the POAObject. In the RETAIN case this
114 ref is released by ORBit_POA_deactivate. In the NON-RETAIN
115 case the ref is released by unuse_servant.
116
117MULTIPLE_ID POAs
118================
119
120 So that a servant can incarnate more than one object, the
121ORBit_POAObject pointed to by the servant's ._private member has a
122.next member pointing to the next Object incarnated by that servant.
123This forms a simple singly-linked list of Objects. A GSList was not
124used so as to not kill the common case of a UNIQUE_ID POA.
125
126 If you look at the note at the end of section 11.3.5.1, it
127says that it is legal for the servant to be shared between two POAs
128with different Object Id uniqueness policies.
129
130 This could create serious problems when we are using
131obtaining the POAObject associated with the servant in the UNIQUE_ID
132case. This needs to fixed to check that it actually belongs to the POA
133in question.
134
135Implementing Another Object Adaptor
136==================================
137
138 ORBit2's POA is virtualised. This means that, in theory, it
139should be possible to plug another Object Adaptor into the ORB. The
140details are in orbit/poa/orbit-adaptor.h.
Note: See TracBrowser for help on using the repository browser.