Hence, DIET also has a built-in mode in which you can dynamically modify its shape using CORBA calls. In this mode, if a DIET element cannot reach its parent, when initializing, it won't exit, but will wait for an order to connect itself to a new parent. Hence, you do not need to deploy DIET starting from the MA down to the SeD, you can launch all the elements at once, and then, send the orders for each element to connect to its correct parent (you do not even need to follow the shape of the tree, you can start from the bottom to the tree up to the root, or use a random order, the service tables will be correctly initialized.)
You now have access to the following CORBA methods:
long bindParent(in string parentName): sends an order to a SeD or agent to bind to a new parent having the name “
parentName” if this parent can be contacted, otherwise the element keeps its old parent. If the element already has a parent, it unsubscribes itself from the parent, so that this latter is able to update its service table and list of children. A null value is returned if the change occurred, otherwise a value different from 0 is returned if a problem occurred.
long disconnect(): sends an order to disconnect an element from its parent. This does not kill the element, but merely removes the link between the element and its parent. Thus, the underlying hierarchy will be unreachable until the element is connected to a new parent.
long removeElement(): sends an order to a SeD to kill itself. The SeD first unsubscribe from its parent before ending itself properly.
long removeElement(in boolean recursive): same as above but for agents. The parameter “
recursive” if true also destroys the underlying hierarchy, otherwise only the agent is killed.
Now, what happens if during a request submission an element receives an order to change its parent? Actually, nothing will change, as whenever a request is received a reference to the parent from which the request originates is locally kept. So if the parent changes before the request is sent back to the parent, as we keep a local reference on the parent, the request will be sent back to the correct “parent”. Hence, for a short period of time, an element can have multiple parents.
WARNING: currently no control is done on whether or not you are creating loops in the hierarchy when changing a parent.
The DIET Team - Mer 29 nov 2017 15:13:36 EST