diff options
Diffstat (limited to 'src')
-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]}}. |