[erlang-questions] Re: supervisors

Wes James <>
Thu Mar 31 17:38:38 CEST 2011


Siri,

The code is from last weeks training part of the Erlang Factory in San
Francisco.  I don't know if Erlang Solutions would like me sending all
the code to people or not.  I'd send it to you off-list if it was ok
with them.

Or maybe you could send me a sample of your code to compare with what I have.

thx,

-wes

On Thu, Mar 31, 2011 at 2:16 AM, Siri Hansen <> wrote:
> Hi Wes,
> It should be possible to do exactly what you want. I have tried to recreate
> your problem, but I did not succeed. If you want to you may post the code
> for the two supervisors and I will have a look at it to see what I'm doing
> different.
> Regards
> /siri
>
>
> 2011/3/30 Wes James <>
>>
>> when I start and app that works fine:
>>
>> =PROGRESS REPORT==== 30-Mar-2011::11:28:05 ===
>>          supervisor: {local,eapp_sup}
>>             started: [{pid,<0.70.0>},
>>                       {name,{a_sup,a1}},
>>                       {mfargs,{a_sup,start_link,[a1]}},
>>                       {restart_type,permanent},
>>                       {shutdown,brutal_kill},
>>                       {child_type,supervisor}]
>>
>> In eapp_sup I have:
>>
>> start_a(Module, Name) ->
>>        supervisor:start_child(?MODULE, child(Module, Name)).
>>
>>
>> child(Module, Name) ->
>>  {{Module, Name}, {Module, start_link, [Name]}, permanent,
>> brutal_kill, supervisor, [Name]}.
>>
>>
>> from starting above it would seem that a_sup has the name a1, but if
>> you run appmon it shows just as a_sup.
>>
>> When I then run
>>
>> eapp:start_a(a_sup,a2).  I would assume that a_sup could load as a
>> second supervisor process with name a2, but this is what I get:
>>
>> eapp_sup:start_a(a_sup,a2).
>> {error,{already_started,<0.70.0>}}
>>
>> I then create a_sup2  and eapp_sup:start_a(a_sup2, a1) and that loads
>> fine, since the module "name" is not the same in the system as a_sup.
>> But it seems like a name should be assigned to these to make them
>> unique by name and be able to use the same supervisor code to
>> supervise some more children.
>>
>> Is that possible?
>>
>> thx,
>>
>> -wes
>> _______________________________________________
>> erlang-questions mailing list
>> 
>> http://erlang.org/mailman/listinfo/erlang-questions
>
>



More information about the erlang-questions mailing list