logo       

upgrade of supervisors child specifications: msg#00388

lang.erlang.general

Subject: upgrade of supervisors child specifications

greetings,

how do i change (when doing an upgrade) the contents of a supervisors
child specifications?


background:

there exists a supervisor with its children. the output of
supervisor:which_children(my_supervisor) => [{Id, Child,Type,Modules},
...]

due to reasons it has been decided to change Id to OtherId during
upgrade. i have identified the other places where Id is stored
(ets/mnesia tables) and successfully transformed these tables. now i
need to change the contents of my_supervisor's child specifications.

the code in supervisor.erl hints at a tantelising possiblity:

code_change(_, State, _) ->
case apply(State#state.module, init,
[State#state.args]) of
{ok, {SupFlags, StartSpec}} ->
case catch check_flags(SupFlags) of
ok ->
update_childspec(State, StartSpec);

as one can see StartSpec is returned from
<my_supervisors_module>:init/1. is this possible to use? how? (ie,
when/why is supervisor:code_change/3 called)
it is fine to just point me to the right place in the documentation.


bengt




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise