summaryrefslogtreecommitdiff
path: root/src/app_utils.erl
diff options
context:
space:
mode:
authorTim Watson <watson.timothy@gmail.com>2013-11-21 21:59:55 +0000
committerTim Watson <watson.timothy@gmail.com>2013-11-21 21:59:55 +0000
commitac2bac239d424ab71c565d8137607e5cc1768d6f (patch)
tree6bc385538ff776abaf91a7900609c2af069701af /src/app_utils.erl
parent33cbee5b3799ef2b301cf513f6fef1103d26bc32 (diff)
downloadrabbitmq-server-git-ac2bac239d424ab71c565d8137607e5cc1768d6f.tar.gz
Re-work boot step handling
We need to support interleaving plugin boot steps with rabbit’s own (internal) ones during the boot/start sequence, and also running them independently during runtime activation. This commit also drops the use of an ets table to track which cleanup steps we’ve run, and simplifies the boot step execution procedures.
Diffstat (limited to 'src/app_utils.erl')
-rw-r--r--src/app_utils.erl16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/app_utils.erl b/src/app_utils.erl
index d08dfe6a5a..22e2df44bb 100644
--- a/src/app_utils.erl
+++ b/src/app_utils.erl
@@ -60,7 +60,7 @@ stop_applications(Apps) ->
start_applications(Apps, ErrorHandler) ->
manage_applications(fun lists:foldl/3,
- fun start/1,
+ fun application:start/1,
fun application:stop/1,
already_started,
ErrorHandler,
@@ -101,7 +101,7 @@ direct_dependencies(Root) ->
end,
sets:from_list([Root]),
digraph:out_edges(G, Root)),
- sets:to_list(sets:del_element(rabbit, Deps))
+ sets:to_list(Deps)
catch {graph_error, Reason} ->
{error, Reason}
after
@@ -132,14 +132,10 @@ app_dependency_order(RootApps, StripUnreachable) ->
%%---------------------------------------------------------------------------
%% Private API
-start(rabbit) ->
- case application:start(rabbit) of
- ok -> rabbit_boot:run_boot_steps(rabbit), ok;
- Err -> Err
- end;
-start(App) ->
- rabbit_boot:run_boot_steps(App),
- application:start(App).
+%% It might be worth documenting this on the plugin author's guide/page.
+%% A plugin should expect its boot steps to run /before/ the application
+%% is started, and its cleanup steps to run /after/ the application has
+%% fully stopped.
wait_for_application(Application) ->
case lists:keymember(Application, 1, rabbit_misc:which_applications()) of