From 9d698172ae5b68953ed899a0743e65f601cd37c7 Mon Sep 17 00:00:00 2001 From: Brian Cully Date: Sat, 1 Mar 2008 14:44:39 -0500 Subject: Prettify the supervision tree w/ names. Break modules out by registered names. --- src/mysqlerl_app.erl | 14 +++----------- src/mysqlerl_sup.erl | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 11 deletions(-) create mode 100644 src/mysqlerl_sup.erl (limited to 'src') 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]}}. -- cgit v1.2.3