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

Fredrik Thulin ft@REDACTED
Tue May 20 08:40:21 CEST 2008


Colin Z wrote:
> 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?

It's an RTFM really, but I'll try to be polite ;)

See the manual for the supervisor module 
(http://www.erlang.org/doc/man/supervisor.html) - there are functions 
called start_child, delete_child and of course which_children.

/Fredrik



More information about the erlang-questions mailing list