diff options
author | Brian Cully <bjc@kublai.com> | 2008-03-01 14:44:39 -0500 |
---|---|---|
committer | Brian Cully <bjc@kublai.com> | 2008-03-01 14:44:39 -0500 |
commit | 9d698172ae5b68953ed899a0743e65f601cd37c7 (patch) | |
tree | 468ea0455fe5f8a33430d8e668cd1051649baf3e | |
parent | d365c3a2be018d93125163974547623cde2b4675 (diff) | |
download | mysqlerl-9d698172ae5b68953ed899a0743e65f601cd37c7.tar.gz mysqlerl-9d698172ae5b68953ed899a0743e65f601cd37c7.zip |
Prettify the supervision tree w/ names. Break modules out by registered names.
-rw-r--r-- | src/mysqlerl_app.erl | 14 | ||||
-rw-r--r-- | src/mysqlerl_sup.erl | 17 |
2 files changed, 20 insertions, 11 deletions
diff --git a/src/mysqlerl_app.erl b/src/mysqlerl_app.erl index 0517d3b..645d799 100644 --- a/src/mysqlerl_app.erl +++ b/src/mysqlerl_app.erl @@ -2,20 +2,12 @@ -author('bjc@kublai.com'). -behavior(application). --behavior(supervisor). --export([start/2, stop/1, init/1]). +-export([start/2, stop/1]). start(normal, []) -> - supervisor:start_link({local, ?MODULE}, ?MODULE, []). + register(?MODULE, self()), + mysqlerl_sup:start_link(). stop([]) -> ok. - -init([]) -> - ConnectionSup = {mysqlerl_connection_sup, - {mysqlerl_connection_sup, start_link, []}, - permanent, infinity, supervisor, - [mysqlerl_connection_sup]}, - {ok, {{one_for_one, 10, 5}, - [ConnectionSup]}}. diff --git a/src/mysqlerl_sup.erl b/src/mysqlerl_sup.erl new file mode 100644 index 0000000..e8c1485 --- /dev/null +++ b/src/mysqlerl_sup.erl @@ -0,0 +1,17 @@ +-module(mysqlerl_sup). +-author('bjc@kublai.com'). + +-behavior(supervisor). + +-export([start_link/0, init/1]). + +start_link() -> + supervisor:start_link({local, ?MODULE}, ?MODULE, []). + +init([]) -> + ConnectionSup = {mysqlerl_connection_sup, + {mysqlerl_connection_sup, start_link, []}, + permanent, infinity, supervisor, + [mysqlerl_connection_sup]}, + {ok, {{one_for_one, 10, 5}, + [ConnectionSup]}}. |