[erlang-questions] Change a Spec of a running supervisor

Anders Nygren anders.nygren@REDACTED
Mon May 19 20:14:47 CEST 2008


2008/5/19 Colin Z <theczintheroc2007@REDACTED>:
> In a supervisor, I use a config variable to determine what module to use in
> one of its worker specifications.
>
> Is there a way to change a spec while an application/supervisor is already
> running?
>
> It's easy enough to change the code of an already loaded module (just
> recompile), but how can I switch between using two different modules?
>
> Specific example:
> I have module for handling logins that I want my supervisor to be in charge
> of. Say that I've started the application and my config variable was
> "basicLoginHandler". Without bringing down the entire application, how can I
> later make the supervisor terminate its "basicLoginHandler" spec and start a
> new worker using a module called "advancedLoginHandler" that I've decided
> should be used instead?
>

Look at supervisor:terminate_child and supervisor:start_child

/Anders



More information about the erlang-questions mailing list