summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Watson <watson.timothy@gmail.com>2013-11-18 12:12:05 +0000
committerTim Watson <watson.timothy@gmail.com>2013-11-18 12:12:05 +0000
commit063126a715524cb39ed8f1173cf8e96e2c91f005 (patch)
tree6d9535a13d0b1724d0527e64d1ff7fcb87584171
parent78f00b12bd31c7b868b0d8579a5447124c85cb66 (diff)
downloadrabbitmq-server-git-063126a715524cb39ed8f1173cf8e96e2c91f005.tar.gz
Rework boot step handling
-rw-r--r--src/app_utils.erl5
-rw-r--r--src/rabbit_boot.erl17
2 files changed, 14 insertions, 8 deletions
diff --git a/src/app_utils.erl b/src/app_utils.erl
index 24c6165efd..1231ea586a 100644
--- a/src/app_utils.erl
+++ b/src/app_utils.erl
@@ -17,7 +17,7 @@
-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]).
+ running_applications/0, wait_for_applications/1, app_dependencies/1]).
-ifdef(use_specs).
@@ -37,6 +37,9 @@
%%---------------------------------------------------------------------------
%% Public API
+running_applications() ->
+ [App || {App, _, _} <- application:which_applications()].
+
load_applications(Apps) ->
load_applications(queue:from_list(Apps), sets:new()),
ok.
diff --git a/src/rabbit_boot.erl b/src/rabbit_boot.erl
index 9df2edc32a..58361e2641 100644
--- a/src/rabbit_boot.erl
+++ b/src/rabbit_boot.erl
@@ -82,18 +82,21 @@ start(Apps) ->
stop(Apps) ->
ensure_boot_table(),
- ShutdownApps = app_utils:app_dependency_order(Apps, true),
+ TargetApps = lists:usort([app_utils:app_dependency_order(App, true) ||
+ InitApp <- Apps,
+ App <- app_utils:app_dependencies(InitApp)]),
+ Ineligible = lists:usort(
+ app_utils:app_dependency_order(
+ [App || App <- app_utils:running_applications(),
+ not lists:member(App, Apps)],
+ true) ++ [rabbit]),
+ ShutdownApps = TargetApps -- Ineligible,
+ io:format("Shutdown apps = ~p~n", [ShutdownApps]),
try
ok = app_utils:stop_applications(
ShutdownApps, handle_app_error(error_during_shutdown))
after
[run_steps(App, rabbit_cleanup_step) || App <- ShutdownApps]
- %[begin
- % Steps =
- % sort_boot_steps(rabbit_misc:all_module_attributes(
- % App, rabbit_cleanup_step)),
- % [run_boot_step(Step) || Step <- Steps]
- % end || App <- ShutdownApps]
end.
run_boot_steps(App) ->