diff options
| author | Tim Watson <watson.timothy@gmail.com> | 2014-03-17 15:58:47 +0000 |
|---|---|---|
| committer | Tim Watson <watson.timothy@gmail.com> | 2014-03-17 15:58:47 +0000 |
| commit | ddca9baeeae77bc4d575b9bd77421ce6a270a30e (patch) | |
| tree | e12c530e036c9000c0b322bfcdfaf491ce711ed1 | |
| parent | 56af31d64fa1d71a112cb4483b4eb5d33e4a8523 (diff) | |
| download | rabbitmq-server-git-ddca9baeeae77bc4d575b9bd77421ce6a270a30e.tar.gz | |
Inline app_utils:update_running_apps/2
| -rw-r--r-- | src/app_utils.erl | 12 | ||||
| -rw-r--r-- | src/rabbit.erl | 7 | ||||
| -rw-r--r-- | src/rabbit_plugins.erl | 14 |
3 files changed, 9 insertions, 24 deletions
diff --git a/src/app_utils.erl b/src/app_utils.erl index 4edee86f2b..56d498997f 100644 --- a/src/app_utils.erl +++ b/src/app_utils.erl @@ -18,12 +18,11 @@ -export([load_applications/1, start_applications/1, start_applications/2, stop_applications/1, stop_applications/2, app_dependency_order/2, wait_for_applications/1, app_dependencies/1, app_modules/1, - which_applications/0, update_running_apps/2]). + which_applications/0]). -ifdef(use_specs). -type error_handler() :: fun((atom(), any()) -> 'ok'). --type diff() :: [atom()]. -spec load_applications([atom()]) -> 'ok'. -spec start_applications([atom()]) -> 'ok'. @@ -33,8 +32,6 @@ -spec wait_for_applications([atom()]) -> 'ok'. -spec app_dependency_order([atom()], boolean()) -> [digraph:vertex()]. -spec app_dependencies(atom()) -> [atom()]. --spec update_running_apps(fun (() -> 'ok'), - fun ((diff()) -> 'ok')) -> 'ok'. -spec which_applications() -> [atom()]. -spec app_modules(atom()) -> [module()]. @@ -43,13 +40,6 @@ %%--------------------------------------------------------------------------- %% Public API -update_running_apps(MakeChanges, WithChanges) -> - Old = sets:from_list(which_applications()), - MakeChanges(), - New = sets:from_list(which_applications()), - Diff = sets:to_list(sets:subtract(New, Old)), - WithChanges(Diff). - which_applications() -> [App || {App, _, _} <- rabbit_misc:which_applications()]. diff --git a/src/rabbit.erl b/src/rabbit.erl index 062b935507..3d043b509c 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -312,7 +312,7 @@ start() -> ok = ensure_working_log_handlers(), rabbit_node_monitor:prepare_cluster_status_files(), rabbit_mnesia:check_cluster_consistency(), - ok = start_apps(app_startup_order()), + start_apps(app_startup_order()), ok = log_broker_started(rabbit_plugins:active()) end). @@ -330,7 +330,7 @@ boot() -> rabbit_mnesia:check_cluster_consistency(), Plugins = rabbit_plugins:setup(), ToBeLoaded = Plugins ++ ?APPS, - ok = start_apps(ToBeLoaded), + start_apps(ToBeLoaded), ok = log_broker_started(Plugins) end). @@ -349,7 +349,8 @@ start_apps(Apps) -> _ -> ok end, ok = app_utils:start_applications(StartupApps, - handle_app_error(could_not_start)). + handle_app_error(could_not_start)), + StartupApps. start_it(StartFun) -> Marker = spawn_link(fun() -> receive stop -> ok end end), diff --git a/src/rabbit_plugins.erl b/src/rabbit_plugins.erl index 1f36ce4ce0..699cf100ca 100644 --- a/src/rabbit_plugins.erl +++ b/src/rabbit_plugins.erl @@ -40,18 +40,12 @@ enable(Plugins) -> prepare_plugins(Plugins), - app_utils:update_running_apps( - fun() -> rabbit:start_apps(Plugins) end, - fun(Diff) -> - ok = rabbit_event:notify(plugins_changed, [{enabled, Diff}]) - end). + Diff = rabbit:start_apps(Plugins), + ok = rabbit_event:notify(plugins_changed, [{enabled, Diff}]). disable(Plugins) -> - app_utils:update_running_apps( - fun() -> rabbit:stop_apps(Plugins) end, - fun(Diff) -> - ok = rabbit_event:notify(plugins_changed, [{disabled, Diff}]) - end). + Diff = rabbit:stop_apps(Plugins), + ok = rabbit_event:notify(plugins_changed, [{disabled, Plugins}]). %% @doc Prepares the file system and installs all enabled plugins. setup() -> |
